thak123 commited on
Commit
e42c394
·
1 Parent(s): 5ddd8f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -103,3 +103,20 @@ demo = gr.Interface(
103
  demo.launch()
104
 
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  demo.launch()
104
 
105
 
106
+ import gradio as gr
107
+
108
+ from transformers import pipeline
109
+
110
+ pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
111
+
112
+ def predict(text):
113
+ return pipe(text)[0]["translation_text"]
114
+
115
+ demo = gr.Interface(
116
+ fn=predict,
117
+ inputs='text',
118
+ outputs='text',
119
+ )
120
+
121
+ demo.launch()
122
+