derful commited on
Commit
a486262
1 Parent(s): b437762

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -46,6 +46,8 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
46
  chatbot.style()
47
  history = gr.State([])
48
  with gr.Column(scale=1):
 
 
49
  with gr.Row():
50
  txt = gr.Textbox(show_label=False, placeholder="Input question here.").style(container=False)
51
  with gr.Row():
@@ -75,7 +77,7 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
75
  top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.01,interactive=True, label="Top-p (nucleus sampling)",)
76
  temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, step=0.01, interactive=True, label="Temperature",)
77
 
78
- predict_args = dict(fn=predict, inputs=[txt, top_p, temperature, chatbot, history, system_prompt], outputs=[chatbot, history, statusDisplay], show_progress=True)
79
  empty_txt_args = dict(fn=lambda: "", inputs=[], outputs=[txt]) # 用于在提交后清空输入栏
80
 
81
  cancel_handles.append(txt.submit(**predict_args))
 
46
  chatbot.style()
47
  history = gr.State([])
48
  with gr.Column(scale=1):
49
+ with gr.Column(scale=12):
50
+ api = gr.Textbox(show_label=False, placeholder="Input OpenAI Key.").style(container=False)
51
  with gr.Row():
52
  txt = gr.Textbox(show_label=False, placeholder="Input question here.").style(container=False)
53
  with gr.Row():
 
77
  top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.01,interactive=True, label="Top-p (nucleus sampling)",)
78
  temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, step=0.01, interactive=True, label="Temperature",)
79
 
80
+ predict_args = dict(fn=predict, inputs=[api, txt, top_p, temperature, chatbot, history, system_prompt], outputs=[chatbot, history, statusDisplay], show_progress=True)
81
  empty_txt_args = dict(fn=lambda: "", inputs=[], outputs=[txt]) # 用于在提交后清空输入栏
82
 
83
  cancel_handles.append(txt.submit(**predict_args))