Spaces:
Runtime error
Runtime error
Commit
Β·
200ccc0
1
Parent(s):
5f40d23
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,8 +39,6 @@ def openai_create(prompt):
|
|
| 39 |
|
| 40 |
return response.choices[0].text
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
def chatgpt_clone(input, history):
|
| 45 |
history = history or []
|
| 46 |
s = list(sum(history, ()))
|
|
@@ -50,12 +48,15 @@ def chatgpt_clone(input, history):
|
|
| 50 |
history.append((input, output))
|
| 51 |
return history, history
|
| 52 |
|
|
|
|
|
|
|
|
|
|
| 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)
|
|
@@ -68,5 +69,4 @@ with gr.Blocks() as demo:
|
|
| 68 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
| 69 |
reset.click(reset_chatbot, inputs=[message, chatbot])
|
| 70 |
|
| 71 |
-
|
| 72 |
demo.launch(inline=False)
|
|
|
|
| 39 |
|
| 40 |
return response.choices[0].text
|
| 41 |
|
|
|
|
|
|
|
| 42 |
def chatgpt_clone(input, history):
|
| 43 |
history = history or []
|
| 44 |
s = list(sum(history, ()))
|
|
|
|
| 48 |
history.append((input, output))
|
| 49 |
return history, history
|
| 50 |
|
| 51 |
+
def reset_chatbot(message, chatbot):
|
| 52 |
+
message.reset()
|
| 53 |
+
chatbot.reset()
|
| 54 |
|
| 55 |
# Gradio Output Model
|
| 56 |
with gr.Blocks() as demo:
|
| 57 |
gr.Markdown("Choose the Chinese NLP model you want to use from the tabs")
|
| 58 |
with gr.Tab("Sentiment Analysis"):
|
| 59 |
+
inputs = gr.Textbox(placeholder="Enter a Chinese positive or negative sentence here")
|
| 60 |
outputs = gr.Textbox(label="Sentiment Analysis")
|
| 61 |
proceed_button = gr.Button("proceed")
|
| 62 |
proceed_button.click(fn=sentiment_analysis, inputs=inputs, outputs=outputs)
|
|
|
|
| 69 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
| 70 |
reset.click(reset_chatbot, inputs=[message, chatbot])
|
| 71 |
|
|
|
|
| 72 |
demo.launch(inline=False)
|