Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,9 +24,18 @@ ARTICLE = '<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts
|
|
24 |
|
25 |
TOKEN = "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"
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
TOKEN = "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"
|
26 |
|
27 |
+
from transformers import pipeline
|
28 |
+
|
29 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
30 |
+
|
31 |
+
def predict(text):
|
32 |
+
return pipe(text)[0]["translation_text"]
|
33 |
+
|
34 |
+
iface = gr.Interface(
|
35 |
+
fn=predict,
|
36 |
+
inputs='text',
|
37 |
+
outputs='text',
|
38 |
+
examples=[["Hello! My name is Omar"]]
|
39 |
+
)
|
40 |
+
|
41 |
+
iface.launch()
|