SBK commited on
Commit
4483fdb
·
verified ·
1 Parent(s): 0358e00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -65,7 +65,7 @@ def generate_response(history, system_prompt):
65
  with gr.Blocks() as demo:
66
  gr.Markdown("## 🧠 Chat with SBK LLM")
67
  system_prompt = gr.Textbox(label="System Prompt", value=SYSTEM_PROMPT, lines=2)
68
- chatbot = gr.Chatbot(format="messages") # Updated to use the new format
69
  msg = gr.Textbox(label="Your Message", placeholder="Ask me anything...", lines=1)
70
  clear = gr.Button("Clear")
71
 
@@ -75,13 +75,15 @@ with gr.Blocks() as demo:
75
  history = history + [[user_message, ""]]
76
  return "", history, generate_response(history, system_prompt)
77
 
78
- # Updated submit handler without stream parameter
79
  msg.submit(
80
  respond,
81
  [msg, history, system_prompt],
82
- [msg, history, chatbot],
83
- queue=False
84
  )
85
  clear.click(lambda: ([], "", ""), outputs=[chatbot, msg, history])
86
 
87
- demo.queue().launch()
 
 
 
 
65
  with gr.Blocks() as demo:
66
  gr.Markdown("## 🧠 Chat with SBK LLM")
67
  system_prompt = gr.Textbox(label="System Prompt", value=SYSTEM_PROMPT, lines=2)
68
+ chatbot = gr.Chatbot() # Reverted to original format
69
  msg = gr.Textbox(label="Your Message", placeholder="Ask me anything...", lines=1)
70
  clear = gr.Button("Clear")
71
 
 
75
  history = history + [[user_message, ""]]
76
  return "", history, generate_response(history, system_prompt)
77
 
78
+ # Updated submit handler
79
  msg.submit(
80
  respond,
81
  [msg, history, system_prompt],
82
+ [msg, history, chatbot]
 
83
  )
84
  clear.click(lambda: ([], "", ""), outputs=[chatbot, msg, history])
85
 
86
+ # Enable streaming through queue
87
+ demo.queue()
88
+
89
+ demo.launch()