abidlabs HF staff commited on
Commit
3cd63fd
1 Parent(s): 3715bae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -14
app.py CHANGED
@@ -1,19 +1,7 @@
1
- import gradio as gr
2
-
3
  from transformers import pipeline
 
4
 
5
  pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
6
 
7
- def predict(text):
8
- return pipe(text)[0]["translation_text"]
9
-
10
- iface = gr.Interface(
11
- fn=predict,
12
- inputs='text',
13
- outputs='text',
14
- examples=[["Hello! My name is Omar"]],
15
- theme="default",
16
- css=".footer{display:none !important}",
17
- )
18
-
19
  iface.launch()
 
 
 
1
  from transformers import pipeline
2
+ import gradio as gr
3
 
4
  pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
5
 
6
+ iface = gr.Interface.from_pipeline(pipe)
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()