abidlabs HF staff commited on
Commit
f4a7a58
1 Parent(s): 3c27342

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,3 +1,20 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("huggingface/t5-base", title="Translate text from English to German using HF APIs!").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ from transformers import pipeline
4
+
5
+ pipe = pipeline("translation", model="t5-base")
6
+
7
+ def predict(text):
8
+ return pipe(text)[0]["translation_text"]
9
+
10
+ title = "English to Spanish Translation (forked from osanseviero/test_gradio)"
11
+
12
+ iface = gr.Interface(
13
+ fn=predict,
14
+ inputs=[gr.inputs.Textbox(label="text", lines=3)],
15
+ outputs='text',
16
+ title=title,
17
+ examples=[["Hello! My name is Abubakar"], ["How are you?"]]
18
+ )
19
+
20
+ iface.launch()