leadingbridge commited on
Commit
5e49ced
Β·
1 Parent(s): edadbff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: "
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
- text_button = gr.Button("proceed")
59
- text_button.click(fn=sentiment_analysis,inputs=gr.Textbox(placeholder="Enter a positive or negative sentence here..."),
60
- outputs=gr.Textbox(label="Sentiment Analysis"))
61
- with gr.Tab("General Chatbot"):
 
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()