Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,16 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
result = pipe("Hello, how are you?")
|
| 6 |
print(result)
|
| 7 |
|
|
|
|
| 8 |
demo = gr.Interface.from_pipeline(pipe)
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
# Use "translation" for specific Helsinki-NLP models
|
| 5 |
+
pipe = pipeline("translation_en_to_es", model="Helsinki-NLP/opus-mt-en-es")
|
| 6 |
+
|
| 7 |
+
# Inference
|
| 8 |
result = pipe("Hello, how are you?")
|
| 9 |
print(result)
|
| 10 |
|
| 11 |
+
# Gradio Interface
|
| 12 |
demo = gr.Interface.from_pipeline(pipe)
|
| 13 |
+
|
| 14 |
+
if __name__ == "__main__":
|
| 15 |
+
demo.launch()
|
| 16 |
+
|