Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
pipe = pipeline("translation", model="t5-base")
|
| 5 |
|
| 6 |
def translate(text, target_language):
|
| 7 |
return pipe(text, target_language=target_language)[0]["translation_text"]
|
|
@@ -36,13 +38,14 @@ def main():
|
|
| 36 |
)
|
| 37 |
|
| 38 |
iface = gr.Interface(
|
| 39 |
-
[translate_interface, clear_interface],
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
)
|
| 43 |
|
| 44 |
iface.launch()
|
| 45 |
|
| 46 |
if __name__ == "__main__":
|
| 47 |
main()
|
| 48 |
-
|
|
|
|
| 1 |
+
pipe = pipeline("translation", model="t5-base", tokenizer_kwargs={"model_max_length": 1024})
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
pipe = pipeline("translation", model="t5-base", tokenizer_kwargs={"model_max_length": 1024})
|
| 7 |
|
| 8 |
def translate(text, target_language):
|
| 9 |
return pipe(text, target_language=target_language)[0]["translation_text"]
|
|
|
|
| 38 |
)
|
| 39 |
|
| 40 |
iface = gr.Interface(
|
| 41 |
+
fn=[translate_interface, clear_interface],
|
| 42 |
+
inputs=[english_textbox, language_select],
|
| 43 |
+
outputs=translated_textbox,
|
| 44 |
+
title="Text Translation",
|
| 45 |
+
description="Translate English text to German, French, or Lao."
|
| 46 |
)
|
| 47 |
|
| 48 |
iface.launch()
|
| 49 |
|
| 50 |
if __name__ == "__main__":
|
| 51 |
main()
|
|
|