arubaDev commited on
Commit
bc117da
·
verified ·
1 Parent(s): b08e1ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -2
app.py CHANGED
@@ -301,6 +301,49 @@ with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.th
301
  interactive=True
302
  )
303
 
304
- gr.Markdown("###
305
- ::contentReference[oaicite:0]{index=0}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
 
 
301
  interactive=True
302
  )
303
 
304
+ gr.Markdown("### ⚙️ Generation Settings")
305
+ system_box = gr.Textbox(
306
+ value=SYSTEM_DEFAULT,
307
+ label="System message",
308
+ lines=4
309
+ )
310
+ max_tokens = gr.Slider(256, 4096, value=1200, step=16, label="Max tokens")
311
+ temperature = gr.Slider(0.0, 2.0, value=0.25, step=0.05, label="Temperature")
312
+ top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-p")
313
+
314
+ with gr.Column(scale=3):
315
+ chatbot = gr.Chatbot(label="Assistant", height=520, type="messages")
316
+ with gr.Row():
317
+ user_box = gr.Textbox(placeholder="Describe your CRUD/backend task…", lines=3, scale=5)
318
+ with gr.Row():
319
+ send_btn = gr.Button("Send ▶️", variant="primary")
320
+ regen_btn = gr.Button("Regenerate 🔁", variant="secondary")
321
+
322
+ # --- Button interactions ---
323
+ refresh_btn.click(refresh_sessions_cb, outputs=session_list)
324
+ new_btn.click(new_chat_cb, outputs=[session_list, chatbot, user_box])
325
+ del_btn.click(delete_chat_cb, inputs=session_list, outputs=[session_list, chatbot])
326
+ session_list.change(load_session_cb, inputs=session_list, outputs=chatbot)
327
+
328
+ send_btn.click(
329
+ send_cb,
330
+ inputs=[user_box, session_list, chatbot, system_box, max_tokens, temperature, top_p, model_choice],
331
+ outputs=[chatbot, user_box, session_list]
332
+ )
333
+
334
+ user_box.submit(
335
+ send_cb,
336
+ inputs=[user_box, session_list, chatbot, system_box, max_tokens, temperature, top_p, model_choice],
337
+ outputs=[chatbot, user_box, session_list]
338
+ )
339
+
340
+ regen_btn.click(
341
+ regenerate_cb,
342
+ inputs=[session_list, system_box, max_tokens, temperature, top_p, model_choice],
343
+ outputs=chatbot
344
+ )
345
+
346
+ if __name__ == "__main__":
347
+ demo.launch()
348
+
349