Rijgersberg commited on
Commit
30784d9
·
verified ·
1 Parent(s): f7728b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -108,7 +108,7 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
108
  #chatbot {height: 520px; overflow: auto;}""") as demo:
109
  gr.HTML(title)
110
  with gr.Column(elem_id = "col_container"):
111
- # openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
112
  chatbot = gr.Chatbot(elem_id='chatbot') #c
113
  inputs = gr.Textbox(placeholder= "Type here!", label= "Type an input and press Enter") #t
114
  state = gr.State([]) #s
@@ -122,6 +122,8 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
122
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
123
  chat_counter = gr.Number(value=0, visible=False, precision=0)
124
 
 
 
125
  inputs.submit( predict, [inputs, top_p, temperature, OPENAI_API_KEY, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
126
  b1.click( predict, [inputs, top_p, temperature, OPENAI_API_KEY, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
127
  b1.click(reset_textbox, [], [inputs])
 
108
  #chatbot {height: 520px; overflow: auto;}""") as demo:
109
  gr.HTML(title)
110
  with gr.Column(elem_id = "col_container"):
111
+ openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
112
  chatbot = gr.Chatbot(elem_id='chatbot') #c
113
  inputs = gr.Textbox(placeholder= "Type here!", label= "Type an input and press Enter") #t
114
  state = gr.State([]) #s
 
122
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
123
  chat_counter = gr.Number(value=0, visible=False, precision=0)
124
 
125
+ openai_api_key = openai_api_key or OPENAI_API_KEY
126
+
127
  inputs.submit( predict, [inputs, top_p, temperature, OPENAI_API_KEY, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
128
  b1.click( predict, [inputs, top_p, temperature, OPENAI_API_KEY, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
129
  b1.click(reset_textbox, [], [inputs])