Update app.py
Browse files
app.py
CHANGED
@@ -57,8 +57,7 @@ def call_nvidia_api(history, max_tokens, temperature, top_p):
|
|
57 |
assistant_message = response_body["choices"][0]["message"]["content"]
|
58 |
history.append({"role": "assistant", "content": assistant_message})
|
59 |
return history
|
60 |
-
|
61 |
-
|
62 |
def chatbot_submit(message, chat_history, system_message, max_tokens_val, temperature_val, top_p_val):
|
63 |
"""Submits the user message to the chatbot and updates the chat history."""
|
64 |
print("Updating chatbot...")
|
@@ -79,12 +78,6 @@ max_tokens = gr.Slider(20, 1024, label="Max Tokens", step=20, value=1024)
|
|
79 |
temperature = gr.Slider(0.0, 1.0, label="Temperature", step=0.1, value=0.2)
|
80 |
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.7)
|
81 |
|
82 |
-
def chatbot_submit(message, chat_history, system_message, max_tokens_val, temperature_val, top_p_val):
|
83 |
-
"""Submits the user message to the chatbot and updates the chat history."""
|
84 |
-
if chat_history is None:
|
85 |
-
chat_history = []
|
86 |
-
chat_history = chatbot_submit(message, chat_history, system_message, max_tokens_val, temperature_val, top_p_val)
|
87 |
-
return chat_history
|
88 |
|
89 |
with gr.Blocks() as demo:
|
90 |
chat_history_state = gr.State([])
|
|
|
57 |
assistant_message = response_body["choices"][0]["message"]["content"]
|
58 |
history.append({"role": "assistant", "content": assistant_message})
|
59 |
return history
|
60 |
+
|
|
|
61 |
def chatbot_submit(message, chat_history, system_message, max_tokens_val, temperature_val, top_p_val):
|
62 |
"""Submits the user message to the chatbot and updates the chat history."""
|
63 |
print("Updating chatbot...")
|
|
|
78 |
temperature = gr.Slider(0.0, 1.0, label="Temperature", step=0.1, value=0.2)
|
79 |
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.7)
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
with gr.Blocks() as demo:
|
83 |
chat_history_state = gr.State([])
|