Spaces:
Runtime error
Runtime error
yms9654
commited on
Commit
•
0e5925a
0
Parent(s):
update
Browse files- .gitattributes +0 -0
- .gitignore +2 -0
- README.md +12 -0
- app.py +27 -0
- model_artifact/.gitattributes +1 -0
- model_artifact/dict.en.txt +0 -0
- model_artifact/dict.ko.txt +0 -0
- model_artifact/subword_tokenizer_ko.model +0 -0
- requirements.txt +3 -0
.gitattributes
ADDED
File without changes
|
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
.venv
|
2 |
+
.vscode
|
README.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Translate
|
3 |
+
emoji: 🔥
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: green
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.6
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
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 |
+
from fairseq.models.transformer import TransformerModel
|
3 |
+
|
4 |
+
ko2en = TransformerModel.from_pretrained(
|
5 |
+
'model_artifact',
|
6 |
+
checkpoint_file='checkpoint_best.pt',
|
7 |
+
data_name_or_path='model_artifact',
|
8 |
+
bpe='sentencepiece',
|
9 |
+
sentencepiece_model='model_artifact/subword_tokenizer_ko.model',
|
10 |
+
source_lang='ko', target_lang='en'
|
11 |
+
)
|
12 |
+
|
13 |
+
def translate(input):
|
14 |
+
return ko2en.translate(input)
|
15 |
+
|
16 |
+
callback = gr.CSVLogger()
|
17 |
+
|
18 |
+
with gr.Blocks() as demo:
|
19 |
+
gr.Label('웹툰 번역기')
|
20 |
+
input = gr.Textbox(label="Input")
|
21 |
+
output = gr.Textbox(label="Output")
|
22 |
+
input.submit(fn=translate, inputs=input, outputs=output)
|
23 |
+
|
24 |
+
btn = gr.Button('오류보고')
|
25 |
+
callback.setup([input, output], 'flagged')
|
26 |
+
btn.click(lambda *args: callback.flag(args), [input, output], None, preprocess=False)
|
27 |
+
demo.launch()
|
model_artifact/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
checkpoint_best.pt filter=lfs diff=lfs merge=lfs -text
|
model_artifact/dict.en.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model_artifact/dict.ko.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model_artifact/subword_tokenizer_ko.model
ADDED
Binary file (877 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
fairseq
|
3 |
+
sentencepiece
|