Update app.py
Browse files
app.py
CHANGED
@@ -103,3 +103,20 @@ demo = gr.Interface(
|
|
103 |
demo.launch()
|
104 |
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
demo.launch()
|
104 |
|
105 |
|
106 |
+
import gradio as gr
|
107 |
+
|
108 |
+
from transformers import pipeline
|
109 |
+
|
110 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
111 |
+
|
112 |
+
def predict(text):
|
113 |
+
return pipe(text)[0]["translation_text"]
|
114 |
+
|
115 |
+
demo = gr.Interface(
|
116 |
+
fn=predict,
|
117 |
+
inputs='text',
|
118 |
+
outputs='text',
|
119 |
+
)
|
120 |
+
|
121 |
+
demo.launch()
|
122 |
+
|