Paco1112 commited on
Commit
648bc4f
·
1 Parent(s): 49dac6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -1,17 +1,16 @@
1
  import gradio as gr
2
- from gradio import inputs
3
- from gradio.inputs import Textbox
4
- from gradio import outputs
5
- from transformers import pipeline
6
 
7
- title = "Next Sentence Generator1"
8
- description = "Try this text generator!"
9
- examples = [
10
- ["Zoe Kwan is a 20-year old singer and songwriter who has taken Hong Kong’s music scene by storm."],
11
- ["Zoe’s big break came when the godfather of Cantopop Sam Hui stumbled upon a YouTube video of Zoe singing."]
12
- ]
13
- generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
14
- generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
15
- generator1 = gr.Interface.load("huggingface/gpt2-large")
16
 
17
- gr.Parallel(generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."), title=title, description=description, examples=examples).launch(share=False, enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from gradio.mix import Series
 
 
 
3
 
4
+ description = "Input Chinese language text, submit and the machine will generate additional English language text."
 
 
 
 
 
 
 
 
5
 
6
+ translator = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-zh-en")
7
+ model1 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
8
+ model2 = gr.Interface.load("huggingface/ckiplab/gpt2-base-chinese")
9
+
10
+ tg_demo = gr.Series(translator, model1, inputs=gr.Textbox(lines=5, label="Input Text"), description=description)
11
+ gt_demo = gr.Series(model2, translator, inputs=gr.Textbox(lines=5, label="Input Text"), description=description)
12
+
13
+ demo = gr.TabbedInterface([tg_demo, gt_demo], ["Chinese Translator to English Generator", "Chinese Generator to English Translator"])
14
+
15
+ if __name__ == "__main__":
16
+ demo.launch()