GiladtheFixer commited on
Commit
8c0443d
1 Parent(s): 5f75b38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -10
app.py CHANGED
@@ -26,19 +26,31 @@
26
 
27
 
28
 
29
- import gradio as gr
 
 
 
 
30
 
31
- from transformers import pipeline
 
32
 
33
- pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ru")
 
 
 
 
34
 
35
- def predict(text):
36
- return pipe(text)[0]["translation_text"]
 
 
 
37
 
38
- demo = gr.Interface(
39
- fn=predict,
40
- inputs='text',
41
- outputs='text',
42
- )
43
 
44
  demo.launch()
 
26
 
27
 
28
 
29
+ # import gradio as gr
30
+
31
+ # from transformers import pipeline
32
+
33
+ # pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ru")
34
 
35
+ # def predict(text):
36
+ # return pipe(text)[0]["translation_text"]
37
 
38
+ # demo = gr.Interface(
39
+ # fn=predict,
40
+ # inputs='text',
41
+ # outputs='text',
42
+ # )
43
 
44
+ # demo.launch()
45
+
46
+
47
+
48
+ import gradio as gr
49
 
50
+ with gr.Blocks() as demo:
51
+ with gr.Tab("Translate to Spanish"):
52
+ gr.load("gradio/helsinki_translation_en_es", src="spaces")
53
+ with gr.Tab("Translate to French"):
54
+ gr.load("abidlabs/en2fr", src="spaces")
55
 
56
  demo.launch()