Wootang01 commited on
Commit
f9eeb1b
·
1 Parent(s): f01569b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -1,11 +1,22 @@
1
  import gradio as gr
2
-
3
  from gradio.mix import Series
4
 
 
 
 
5
  translator = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-zh-en")
6
  model1 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- title = "Chinese-English Translator and Text Generator"
9
- description = "Input Chinese language text, submit and the machine will generate additional English language text."
10
 
11
- gr.Series(translator, model1, inputs=gr.Textbox(lines=5, label="Input Text"), title=title, description=description).launch(debug=True)
 
1
  import gradio as gr
 
2
  from gradio.mix import Series
3
 
4
+ title = "Chinese Language Translator and Text Generator"
5
+ description = "Input Chinese language text, submit and the machine will generate additional English language text."
6
+
7
  translator = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-zh-en")
8
  model1 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
9
+ model2 = gr.Interface.load("huggingface/ckiplab/gpt2-base-chinese")
10
+
11
+ tg_demo = gr.Series(translator, model1, inputs=gr.Textbox(lines=5, label="Input Text"), outputs="text")
12
+ gt_demo = gr.Series(model2, translator, inputs=gr.Textbox(lines=5, label="Input Text"), outputs="text")
13
+
14
+ demo = gr.TabbedInterface([tg_demo, gt_demo], ["Chinese Translator to English Generator", "Chinese Generator to English Translator"])
15
+
16
+ if __name__ == "__main__":
17
+ demo.launch()
18
+
19
+
20
+
21
 
 
 
22