Spaces:
Runtime error
Runtime error
Commit
·
82a0bb9
1
Parent(s):
c6b46ef
Update app.py
Browse files
app.py
CHANGED
@@ -79,27 +79,27 @@ def translate_to_english(text_to_translate):
|
|
79 |
# Gradio Output Model
|
80 |
with gr.Blocks() as demo:
|
81 |
gr.Markdown("Welcome to the Chinese NLP demo! Please select a model tab to interact with: ")
|
82 |
-
with gr.Tab("🗣️
|
83 |
-
gr.Markdown("
|
84 |
chatbot = gr.Chatbot()
|
85 |
message = gr.Textbox(placeholder=prompt)
|
86 |
state = gr.State()
|
87 |
submit = gr.Button("Send")
|
88 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
89 |
with gr.Tab("🤗Sentiment Analysis"):
|
90 |
-
gr.Markdown("
|
91 |
inputs = gr.Textbox(placeholder="Type a Chinese sentence here, either positive or negative in sentiment.")
|
92 |
outputs = gr.Textbox(label="Sentiment Analysis")
|
93 |
proceed_button = gr.Button("Proceed")
|
94 |
proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
|
95 |
-
with gr.Tab("🀄Translation
|
96 |
-
gr.Markdown("Translate an English sentence to Chinese. Enter an English sentence in the input box and click the 'Translate' button to get the translation result in Chinese.")
|
97 |
inputs = gr.Textbox(placeholder="Enter a short English sentence to translate to Chinese here.")
|
98 |
outputs = gr.Textbox(label="Translation Result")
|
99 |
proceed_button = gr.Button("Translate")
|
100 |
proceed_button.click(fn=translate_to_chinese, inputs=inputs, outputs=outputs)
|
101 |
-
with gr.Tab("🔤Translation
|
102 |
-
gr.Markdown("Translate a Chinese sentence to English. Enter a Chinese sentence in the input box and click the 'Translate' button to get the translation result in English.")
|
103 |
inputs = gr.Textbox(placeholder="Enter a short Chinese sentence to translate to English here.")
|
104 |
outputs = gr.Textbox(label="Translation Result")
|
105 |
proceed_button = gr.Button("Translate")
|
|
|
79 |
# Gradio Output Model
|
80 |
with gr.Blocks() as demo:
|
81 |
gr.Markdown("Welcome to the Chinese NLP demo! Please select a model tab to interact with: ")
|
82 |
+
with gr.Tab("🗣️Chatbot"):
|
83 |
+
gr.Markdown("This is a Chinese chatbot powered by the OpenAI language model. Enter your message below in Chinese and the chatbot will respond.")
|
84 |
chatbot = gr.Chatbot()
|
85 |
message = gr.Textbox(placeholder=prompt)
|
86 |
state = gr.State()
|
87 |
submit = gr.Button("Send")
|
88 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
89 |
with gr.Tab("🤗Sentiment Analysis"):
|
90 |
+
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.")
|
91 |
inputs = gr.Textbox(placeholder="Type a Chinese sentence here, either positive or negative in sentiment.")
|
92 |
outputs = gr.Textbox(label="Sentiment Analysis")
|
93 |
proceed_button = gr.Button("Proceed")
|
94 |
proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
|
95 |
+
with gr.Tab("🀄Chinese Translation"):
|
96 |
+
gr.Markdown("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.")
|
97 |
inputs = gr.Textbox(placeholder="Enter a short English sentence to translate to Chinese here.")
|
98 |
outputs = gr.Textbox(label="Translation Result")
|
99 |
proceed_button = gr.Button("Translate")
|
100 |
proceed_button.click(fn=translate_to_chinese, inputs=inputs, outputs=outputs)
|
101 |
+
with gr.Tab("🔤English Translation"):
|
102 |
+
gr.Markdown("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.")
|
103 |
inputs = gr.Textbox(placeholder="Enter a short Chinese sentence to translate to English here.")
|
104 |
outputs = gr.Textbox(label="Translation Result")
|
105 |
proceed_button = gr.Button("Translate")
|