Spaces:
Runtime error
Runtime error
GiladtheFixer
commited on
Commit
•
e59973f
1
Parent(s):
76450e5
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,20 @@ from transformers import pipeline
|
|
4 |
|
5 |
|
6 |
|
7 |
-
pipe=pipeline('sentiment-analysis')
|
8 |
|
9 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
return pipe(text)
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
-
demo = gr.Interface(fn=
|
16 |
demo.launch()
|
|
|
4 |
|
5 |
|
6 |
|
|
|
7 |
|
8 |
+
def translate(text,number):
|
9 |
+
if number==1:
|
10 |
+
model='Helsinki-NLP/opus-mt-en-es'
|
11 |
+
else if number==2:
|
12 |
+
model='Helsinki-NLP/opus-mt-en-fr'
|
13 |
+
else:
|
14 |
+
model='Helsinki-NLP/opus-mt-en-ru'
|
15 |
+
|
16 |
+
pipe=pipeline(model)
|
17 |
return pipe(text)
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
+
demo = gr.Interface(fn=translate, inputs="text,number", outputs="json")
|
23 |
demo.launch()
|