Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 4 |
|
|
@@ -22,8 +24,8 @@ def translate(text, num_beams=4, num_return_sequences=4):
|
|
| 22 |
for translation in tokenizer.batch_decode(translated_tokens, skip_special_tokens=True):
|
| 23 |
translations.append(translation)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
return
|
| 27 |
|
| 28 |
output = gr.Textbox()
|
| 29 |
# with gr.Accordion("Advanced Options"):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
|
| 5 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 6 |
|
|
|
|
| 24 |
for translation in tokenizer.batch_decode(translated_tokens, skip_special_tokens=True):
|
| 25 |
translations.append(translation)
|
| 26 |
|
| 27 |
+
result = {"input":text, "translations":translations}
|
| 28 |
+
return json.dumps(result)
|
| 29 |
|
| 30 |
output = gr.Textbox()
|
| 31 |
# with gr.Accordion("Advanced Options"):
|