Update app.py
Browse files
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(
|
| 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
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|