smartdigitalnetworks commited on
Commit
987c4c9
·
verified ·
1 Parent(s): 2f4aff0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,9 +1,16 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
- pipe = pipeline("text2text-generation", model="Helsinki-NLP/opus-mt-en-es")
 
 
 
5
  result = pipe("Hello, how are you?")
6
  print(result)
7
 
 
8
  demo = gr.Interface.from_pipeline(pipe)
9
- demo.launch()
 
 
 
 
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
+