Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
translation_pipeline = pipeline('translation_en_to_de')
|
4 |
+
results = translation_pipeline('I love ice cream')
|
5 |
+
results[0]['translation_text']
|
6 |
+
def translate_transformers(from_text):
|
7 |
+
results = translation_pipeline(from_text)
|
8 |
+
return results[0]['translation_text']
|
9 |
+
|
10 |
+
interface = gr.Interface(fn=translate_transformers,
|
11 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder='Text to translate'),
|
12 |
+
outputs='text')
|
13 |
+
|
14 |
+
interface.launch()
|