Spaces:
Runtime error
Runtime error
Commit
Β·
5e49ced
1
Parent(s):
edadbff
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ openai.api_key = "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"
|
|
| 22 |
start_sequence = "\nAI:"
|
| 23 |
restart_sequence = "\nHuman: "
|
| 24 |
|
| 25 |
-
prompt = "The following is a conversation with an AI assistant.
|
| 26 |
|
| 27 |
def openai_create(prompt):
|
| 28 |
|
|
@@ -53,12 +53,13 @@ def chatgpt_clone(input, history):
|
|
| 53 |
|
| 54 |
# Gradio Output Model
|
| 55 |
with gr.Blocks() as demo:
|
| 56 |
-
gr.Markdown("Choose the Chinese NLP model you want to use
|
| 57 |
with gr.Tab("Sentiment Analysis"):
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
| 62 |
chatbot = gr.Chatbot()
|
| 63 |
message = gr.Textbox(placeholder=prompt)
|
| 64 |
state = gr.State()
|
|
|
|
| 22 |
start_sequence = "\nAI:"
|
| 23 |
restart_sequence = "\nHuman: "
|
| 24 |
|
| 25 |
+
prompt = "The following is a conversation with an AI assistant. You can discuss any topic with the assistant in Chinese "
|
| 26 |
|
| 27 |
def openai_create(prompt):
|
| 28 |
|
|
|
|
| 53 |
|
| 54 |
# Gradio Output Model
|
| 55 |
with gr.Blocks() as demo:
|
| 56 |
+
gr.Markdown("Choose the Chinese NLP model you want to use from the tabs")
|
| 57 |
with gr.Tab("Sentiment Analysis"):
|
| 58 |
+
inputs = gr.Textbox(placeholder="Enter a Chinese positive or negative sentence here.")
|
| 59 |
+
outputs = gr.Textbox(label="Sentiment Analysis")
|
| 60 |
+
proceed_button = gr.Button("proceed")
|
| 61 |
+
proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
|
| 62 |
+
with gr.Tab("OpenAI Chatbot"):
|
| 63 |
chatbot = gr.Chatbot()
|
| 64 |
message = gr.Textbox(placeholder=prompt)
|
| 65 |
state = gr.State()
|