leadingbridge commited on
Commit
b731d08
1 Parent(s): 4d93fd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -89,37 +89,33 @@ with gr.Blocks() as demo:
89
  gr.Markdown('Welcome to the Chinese NLP Demo! Please select a model tab to interact with:')
90
  with gr.Tab("🗣️Chatbot"):
91
  gr.Markdown("""<h4><center>🗣️Chatbot</center></h4>""")
92
- gr.Markdown("This is a Chinese chatbot powered by the OpenAI language model. Enter your message below in Chinese and the chatbot will respond.")
93
  chatbot = gr.Chatbot()
94
  message = gr.Textbox(placeholder="You can discuss any topic with the Chinese Chatbot assistant by typing Chinese in here",lines=3)
95
  state = gr.State()
96
  submit = gr.Button("Send")
97
- submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])gr.Markdown("This is a Chinese chatbot powered by the OpenAI language model. Enter your message above in Chinese and the chatbot will respond.")
98
-
99
  with gr.Tab("🤗Sentiment Analysis"):
100
  gr.Markdown("""<h4><center>🤗Sentiment Analysis</center></h4>""")
101
- gr.Markdown("This is a self-trained fine-tuned model using Chinese BERT for sentiment analysis. Enter a sentence in Chinese in the input box and click the 'proceed' button to get the sentiment analysis result.")
102
  inputs = gr.Textbox(placeholder="Type a Chinese sentence here, either positive or negative in sentiment.",lines=3)
103
  outputs = gr.Textbox(label="Sentiment Analysis")
104
  proceed_button = gr.Button("Proceed")
105
  proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
106
-
107
  with gr.Tab("🀄Chinese Translation"):
108
  gr.Markdown("""<h4><center>🀄Chinese Translation</center></h4>""")
109
- gr.Markdown("This model translate an English sentence to Chinese using the OpenAI engine. Enter an English short sentence in the input box and click the 'Translate' button to get the translation result in Chinese.")
110
  inputs = gr.Textbox(placeholder="Enter a short English sentence to translate to Chinese here.",lines=3)
111
  outputs = gr.Textbox(label="Translation Result")
112
  proceed_button = gr.Button("Translate")
113
  proceed_button.click(fn=openai_translation_ec, inputs=inputs, outputs=outputs)
114
-
115
  with gr.Tab("🔤English Translation"):
116
  gr.Markdown("""<h4><center>🔤English Translation</center></h4>""")
117
- gr.Markdown("This model translate a Chinese sentence to English using the OpenAI engine. Enter a Chinese short sentence in the input box and click the 'Translate' button to get the translation result in English.")
118
  inputs = gr.Textbox(placeholder="Enter a short Chinese sentence to translate to English here.",lines=3)
119
  outputs = gr.Textbox(label="Translation Result")
120
  proceed_button = gr.Button("Translate")
121
  proceed_button.click(fn=openai_translation_ce, inputs=inputs, outputs=outputs)
122
-
123
  gr.Markdown('''
124
  We are happy to share with you some Chinese language models that we've made using NLP. When we looked online, we noticed that there weren't many resources available for Chinese NLP, so we hope that our models can be useful to you.
125
  We want to mention that these models aren't perfect and there is still room for improvement. Because of limited resources, there might be some mistakes or limitations in the models.
 
89
  gr.Markdown('Welcome to the Chinese NLP Demo! Please select a model tab to interact with:')
90
  with gr.Tab("🗣️Chatbot"):
91
  gr.Markdown("""<h4><center>🗣️Chatbot</center></h4>""")
 
92
  chatbot = gr.Chatbot()
93
  message = gr.Textbox(placeholder="You can discuss any topic with the Chinese Chatbot assistant by typing Chinese in here",lines=3)
94
  state = gr.State()
95
  submit = gr.Button("Send")
96
+ submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
97
+ gr.Markdown("This is a Chinese chatbot powered by the OpenAI language model. Enter your message above in Chinese and the chatbot will respond.")
98
  with gr.Tab("🤗Sentiment Analysis"):
99
  gr.Markdown("""<h4><center>🤗Sentiment Analysis</center></h4>""")
 
100
  inputs = gr.Textbox(placeholder="Type a Chinese sentence here, either positive or negative in sentiment.",lines=3)
101
  outputs = gr.Textbox(label="Sentiment Analysis")
102
  proceed_button = gr.Button("Proceed")
103
  proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
104
+ gr.Markdown("This is a self-trained fine-tuned model using Chinese BERT for sentiment analysis. Enter a sentence in Chinese in the input box and click the 'proceed' button to get the sentiment analysis result.")
105
  with gr.Tab("🀄Chinese Translation"):
106
  gr.Markdown("""<h4><center>🀄Chinese Translation</center></h4>""")
 
107
  inputs = gr.Textbox(placeholder="Enter a short English sentence to translate to Chinese here.",lines=3)
108
  outputs = gr.Textbox(label="Translation Result")
109
  proceed_button = gr.Button("Translate")
110
  proceed_button.click(fn=openai_translation_ec, inputs=inputs, outputs=outputs)
111
+ gr.Markdown("This model translate an English sentence to Chinese using the OpenAI engine. Enter an English short sentence in the input box and click the 'Translate' button to get the translation result in Chinese.")
112
  with gr.Tab("🔤English Translation"):
113
  gr.Markdown("""<h4><center>🔤English Translation</center></h4>""")
 
114
  inputs = gr.Textbox(placeholder="Enter a short Chinese sentence to translate to English here.",lines=3)
115
  outputs = gr.Textbox(label="Translation Result")
116
  proceed_button = gr.Button("Translate")
117
  proceed_button.click(fn=openai_translation_ce, inputs=inputs, outputs=outputs)
118
+ gr.Markdown("This model translate a Chinese sentence to English using the OpenAI engine. Enter a Chinese short sentence in the input box and click the 'Translate' button to get the translation result in English.")
119
  gr.Markdown('''
120
  We are happy to share with you some Chinese language models that we've made using NLP. When we looked online, we noticed that there weren't many resources available for Chinese NLP, so we hope that our models can be useful to you.
121
  We want to mention that these models aren't perfect and there is still room for improvement. Because of limited resources, there might be some mistakes or limitations in the models.