mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
1 parent
e942fe4f04
commit
dd87f353aa
3 files changed
+16
-12
No files matched your search
Vendored
+4
@@ -47,3 +47,7 @@ interface JSON {
|
|||||||
parseBigInt: (jsonStr: string, options?: { minDigits?: number; fallbackToString?: boolean; }) => any;
|
parseBigInt: (jsonStr: string, options?: { minDigits?: number; fallbackToString?: boolean; }) => any;
|
||||||
rawJSON(value: string): any;
|
rawJSON(value: string): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Navigator {
|
||||||
|
gpu?: any;
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { TranslationPipeline, TranslationSingle } from '@huggingface/transformers';
|
import type { TranslationPipeline, TranslationSingle } from '@huggingface/transformers';
|
||||||
import { pipeline } from '@huggingface/transformers';
|
import { env, pipeline } from '@huggingface/transformers';
|
||||||
|
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||||
|
|
||||||
|
env.useBrowserCache = true;
|
||||||
|
env.allowRemoteModels = true;
|
||||||
|
|
||||||
// State
|
// State
|
||||||
const inputText = ref('');
|
const inputText = ref('');
|
||||||
const translatedText = ref('');
|
const translatedText = ref('');
|
||||||
const error = ref('');
|
const error = ref('');
|
||||||
const sourceLang = ref('en');
|
const sourceLang = useQueryParamOrStorage({ name: 'from', storageName: 'translator:from', defaultValue: 'en' });
|
||||||
const targetLang = ref('fr');
|
const targetLang = useQueryParamOrStorage({ name: 'to', storageName: 'translator:to', defaultValue: 'fr' });
|
||||||
const loadingModel = ref(false);
|
const loadingModel = ref(false);
|
||||||
const translating = ref(false);
|
const translating = ref(false);
|
||||||
|
|
||||||
@@ -130,14 +134,10 @@ async function translateText() {
|
|||||||
</NButton>
|
</NButton>
|
||||||
</n-space>
|
</n-space>
|
||||||
|
|
||||||
<div mb-3 mt-3>
|
<n-space justify="center" mb-3 mt-3>
|
||||||
<NSpin v-if="loadingModel" size="large">
|
<NSpin v-if="loadingModel" size="large" description="Loading translation model..." />
|
||||||
Loading translation model...
|
<NSpin v-if="translating" size="large" description="Translating..." />
|
||||||
</NSpin>
|
</n-space>
|
||||||
<NSpin v-if="translating" size="large">
|
|
||||||
Translating...
|
|
||||||
</NSpin>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<c-alert v-if="error" mb-2>
|
<c-alert v-if="error" mb-2>
|
||||||
{{ error }}
|
{{ error }}
|
||||||
|
|||||||
+1
-1
@@ -161,7 +161,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: ['isolated-vm', 'pdfjs-dist', 'onnxruntime-node', 'unpdf', 'unpdf/pdfjs', ...(process.env.VERCEL ? ['webcrypto-liner-shim'] : [])], // optionally specify dependency name
|
include: ['isolated-vm', 'pdfjs-dist', 'onnxruntime-node', 'onnxruntime-web', 'unpdf', 'unpdf/pdfjs', ...(process.env.VERCEL ? ['webcrypto-liner-shim'] : [])], // optionally specify dependency name
|
||||||
esbuildOptions: {
|
esbuildOptions: {
|
||||||
supported: {
|
supported: {
|
||||||
'top-level-await': true,
|
'top-level-await': true,
|
||||||
|
|||||||
Reference in new issue
Block a user