Update app.py
Browse files
app.py
CHANGED
@@ -56,8 +56,8 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], hi
|
|
56 |
payload = {
|
57 |
"model": "gpt-3.5-turbo",
|
58 |
"messages": messages, # Of the type of [{"role": "user", "content": f"{inputs}"}],
|
59 |
-
"temperature" :
|
60 |
-
"top_p":
|
61 |
"n" : 1,
|
62 |
"stream": True,
|
63 |
"presence_penalty":2,
|
@@ -142,13 +142,13 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
|
|
142 |
server_status_code = gr.Textbox(label="Status code from OpenAI server", )'''
|
143 |
|
144 |
#top_p, temperature
|
145 |
-
with gr.Accordion("Parameters", open=False):
|
146 |
-
top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
147 |
-
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
148 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
149 |
|
150 |
#Event handling
|
151 |
-
inputs.submit( predict, [system_msg, inputs,
|
152 |
#b1.click( predict, [system_msg, inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
|
153 |
|
154 |
#b1.click(reset_textbox, [], [inputs])
|
|
|
56 |
payload = {
|
57 |
"model": "gpt-3.5-turbo",
|
58 |
"messages": messages, # Of the type of [{"role": "user", "content": f"{inputs}"}],
|
59 |
+
"temperature" : 0.2,
|
60 |
+
"top_p": 1.0,
|
61 |
"n" : 1,
|
62 |
"stream": True,
|
63 |
"presence_penalty":2,
|
|
|
142 |
server_status_code = gr.Textbox(label="Status code from OpenAI server", )'''
|
143 |
|
144 |
#top_p, temperature
|
145 |
+
#with gr.Accordion("Parameters", open=False):
|
146 |
+
#top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
147 |
+
#temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
148 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
149 |
|
150 |
#Event handling
|
151 |
+
inputs.submit( predict, [system_msg, inputs, chat_counter, chatbot, state], [chatbot, state, chat_counter,],) #openai_api_key
|
152 |
#b1.click( predict, [system_msg, inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
|
153 |
|
154 |
#b1.click(reset_textbox, [], [inputs])
|