yahanyang777 commited on
Commit
9879508
·
1 Parent(s): 31b8e6f

fixing none output issue

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -95,11 +95,11 @@ OPENAI_API_KEY = ''
95
  # error_message = f"An unexpected error: {e}"
96
  # return error_message, chat_history
97
 
98
- # def get_opeanai_key(openai_key):
99
- # global OPENAI_API_KEY
100
- # OPENAI_API_KEY=openai_key
101
 
102
- # return {chatbot_col: gr.Column(visible=True)}
103
 
104
 
105
  def slow_echo(usr_message, chat_history):
@@ -156,12 +156,12 @@ with gr.Blocks() as demo:
156
  btn = gr.Button(value="Submit")
157
 
158
  with gr.Column(visible=False) as chatbot_col:
159
- chatbot = gr.Chatbot()
160
- msg = gr.Textbox(label='Type in your questions about Chartis here and press Enter!',
161
  placeholder='Type in your questions.', scale=7)
162
- clear = gr.ClearButton([msg, chatbot])
163
-
164
- msg.submit(slow_echo, [msg, chatbot], [msg, chatbot])
165
 
166
  btn.click(get_opeanai_key, inputs=[openai_gpt_key], outputs=[chatbot_col])
167
 
 
95
  # error_message = f"An unexpected error: {e}"
96
  # return error_message, chat_history
97
 
98
+ def get_opeanai_key(openai_key):
99
+ global OPENAI_API_KEY
100
+ OPENAI_API_KEY=openai_key
101
 
102
+ return {chatbot_col: gr.Column(visible=True)}
103
 
104
 
105
  def slow_echo(usr_message, chat_history):
 
156
  btn = gr.Button(value="Submit")
157
 
158
  with gr.Column(visible=False) as chatbot_col:
159
+ chatbot = gr.Chatbot()
160
+ msg = gr.Textbox(label='Type in your questions about Chartis here and press Enter!',
161
  placeholder='Type in your questions.', scale=7)
162
+ clear = gr.ClearButton([msg, chatbot])
163
+
164
+ msg.submit(slow_echo, [msg, chatbot], [msg, chatbot])
165
 
166
  btn.click(get_opeanai_key, inputs=[openai_gpt_key], outputs=[chatbot_col])
167