lingvanex commited on
Commit
11934c6
·
1 Parent(s): 46cb1cd

Upload 8 files

Browse files
Files changed (8) hide show
  1. README.md +5 -5
  2. app.py +27 -0
  3. en.spm.model +3 -0
  4. ku.spm.model +3 -0
  5. model.bin +3 -0
  6. requirements.txt +2 -0
  7. source_vocabulary.txt +0 -0
  8. target_vocabulary.txt +0 -0
README.md CHANGED
@@ -1,13 +1,13 @@
1
  ---
2
- title: Lingvanex En-ku Translator
3
  emoji: 🏢
4
- colorFrom: gray
5
- colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
  app_file: app.py
9
  pinned: false
10
- license: cc-by-nd-4.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Lingvanex En-zu Translator
3
  emoji: 🏢
4
+ colorFrom: red
5
+ colorTo: green
6
  sdk: gradio
7
+ sdk_version: 3.50.0
8
  app_file: app.py
9
  pinned: false
10
+ license: cc-by-nc-nd-4.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import sentencepiece as spm
3
+ import ctranslate2
4
+
5
+
6
+ description = "Translator"
7
+ title = "Translate!"
8
+
9
+ translator = ctranslate2.Translator("./", device="cpu")
10
+
11
+ spm_encoder = spm.SentencePieceProcessor("./en.spm.model")
12
+ spm_decoder = spm.SentencePieceProcessor("./zu.spm.model")
13
+
14
+ def translate(text):
15
+
16
+ tokens = spm_encoder.encode(text, out_type=str)
17
+ result = translator.translate_batch([tokens])
18
+ output = spm_decoder.decode(result[0].hypotheses[0], out_type=str)
19
+ return output
20
+
21
+ iface = gr.Interface(
22
+ translate,
23
+ inputs="text",
24
+ outputs="text"
25
+ )
26
+
27
+ iface.launch()
en.spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ef75f41803ed338ac13aa049e754b74d18de7e62e8d162b567b66a644a07236
3
+ size 762865
ku.spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d881bd1f605eae2b1b1b6d61143373ea1675fbfa4e78cc70006378ff6f6048ef
3
+ size 776615
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:820c4f348cdd8962f13fb11ccaa24e8d00316e1542b5203f4c20ee7611bd9a4f
3
+ size 270162402
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ctranslate2
2
+ sentencepiece
source_vocabulary.txt ADDED
The diff for this file is too large to render. See raw diff
 
target_vocabulary.txt ADDED
The diff for this file is too large to render. See raw diff