Update app.py
Browse files
app.py
CHANGED
@@ -159,8 +159,8 @@ with gr.Blocks() as demo:
|
|
159 |
# Chatbot display
|
160 |
chatbot = gr.Chatbot(label="NVC Chatbot")
|
161 |
|
162 |
-
#
|
163 |
-
with gr.
|
164 |
system_prompt = gr.Textbox(value=nvc_prompt_template, label="System Prompt (modifiable)")
|
165 |
|
166 |
# Controls for generation parameters
|
@@ -184,26 +184,4 @@ with gr.Blocks() as demo:
|
|
184 |
response = ""
|
185 |
for r in gen:
|
186 |
response = r # In a streaming scenario, you might update the UI incrementally.
|
187 |
-
history.append((message,
|
188 |
-
return history, history
|
189 |
-
|
190 |
-
# Trigger the chat step on button click or when submitting the textbox.
|
191 |
-
send_button.click(
|
192 |
-
chat_step,
|
193 |
-
inputs=[user_input, state, system_prompt, max_tokens_slider, temperature_slider, top_p_slider],
|
194 |
-
outputs=[chatbot, state],
|
195 |
-
)
|
196 |
-
user_input.submit(
|
197 |
-
chat_step,
|
198 |
-
inputs=[user_input, state, system_prompt, max_tokens_slider, temperature_slider, top_p_slider],
|
199 |
-
outputs=[chatbot, state],
|
200 |
-
)
|
201 |
-
|
202 |
-
# Clear memory: resets both the chatbot display and the state.
|
203 |
-
def clear_history():
|
204 |
-
return [], []
|
205 |
-
|
206 |
-
clear_button.click(clear_history, inputs=[], outputs=[chatbot, state])
|
207 |
-
|
208 |
-
if __name__ == "__main__":
|
209 |
-
demo.launch()
|
|
|
159 |
# Chatbot display
|
160 |
chatbot = gr.Chatbot(label="NVC Chatbot")
|
161 |
|
162 |
+
# Settings accordion to hide the system prompt by default
|
163 |
+
with gr.Accordion("Settings", open=False):
|
164 |
system_prompt = gr.Textbox(value=nvc_prompt_template, label="System Prompt (modifiable)")
|
165 |
|
166 |
# Controls for generation parameters
|
|
|
184 |
response = ""
|
185 |
for r in gen:
|
186 |
response = r # In a streaming scenario, you might update the UI incrementally.
|
187 |
+
history.append((message,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|