Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
import json
|
3 |
-
|
4 |
|
5 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
6 |
|
@@ -24,8 +22,8 @@ def translate(text, num_beams=4, num_return_sequences=4):
|
|
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
|
29 |
|
30 |
output = gr.Textbox()
|
31 |
# with gr.Accordion("Advanced Options"):
|
@@ -53,9 +51,9 @@ examples = [
|
|
53 |
gr.Interface(
|
54 |
fn=translate,
|
55 |
inputs=["text", num_beams, num_return_sequences],
|
56 |
-
outputs=output,
|
57 |
title=title,
|
58 |
-
examples=examples,
|
59 |
article=article).launch()
|
60 |
|
61 |
# import gradio as gr
|
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
4 |
|
|
|
22 |
for translation in tokenizer.batch_decode(translated_tokens, skip_special_tokens=True):
|
23 |
translations.append(translation)
|
24 |
|
25 |
+
# result = {"input":text, "translations":translations}
|
26 |
+
return text, translations
|
27 |
|
28 |
output = gr.Textbox()
|
29 |
# with gr.Accordion("Advanced Options"):
|
|
|
51 |
gr.Interface(
|
52 |
fn=translate,
|
53 |
inputs=["text", num_beams, num_return_sequences],
|
54 |
+
outputs=["text", output],
|
55 |
title=title,
|
56 |
+
# examples=examples,
|
57 |
article=article).launch()
|
58 |
|
59 |
# import gradio as gr
|