Dina-Raslan commited on
Commit
5147dd1
Β·
verified Β·
1 Parent(s): 18aa341

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -619,7 +619,7 @@ def chat_with_groq(message, history):
619
  return f"Error: {str(e)}"
620
 
621
  # ── Gradio UI ─────────────────────────────────────────────────────────────────
622
- with gr.Blocks(title="CKD-MultiVision", theme=gr.themes.Soft()) as demo:
623
  gr.Markdown("""
624
  # CKD-MultiVision
625
  ### Multimodal AI System for Early Chronic Kidney Disease Detection
@@ -708,7 +708,7 @@ with gr.Blocks(title="CKD-MultiVision", theme=gr.themes.Soft()) as demo:
708
  # ── Tab 2: CKD Health Coach ────────────────────────────────────────
709
  with gr.TabItem(" CKD Health Coach"):
710
  gr.Markdown("### Ask about diet, lifestyle, exercise, and kidney health.")
711
- chatbot = gr.Chatbot(height=450, type="messages")
712
  chat_input = gr.Textbox(placeholder="Ask a question about CKD...", label="Your Message")
713
  send_btn = gr.Button("Send", variant="primary")
714
  gr.Examples(
@@ -793,12 +793,12 @@ with gr.Blocks(title="CKD-MultiVision", theme=gr.themes.Soft()) as demo:
793
  if not message.strip():
794
  return history, ""
795
  bot_response = chat_with_groq(message, history)
796
- history.append({"role": "user", "content": message})
797
- history.append({"role": "assistant", "content": bot_response})
798
  return history, ""
799
 
800
  send_btn.click(fn=respond, inputs=[chat_input, chatbot], outputs=[chatbot, chat_input])
801
  chat_input.submit(fn=respond, inputs=[chat_input, chatbot], outputs=[chatbot, chat_input])
802
 
803
  if __name__ == "__main__":
804
- demo.launch()
 
619
  return f"Error: {str(e)}"
620
 
621
  # ── Gradio UI ─────────────────────────────────────────────────────────────────
622
+ with gr.Blocks(title="CKD-MultiVision") as demo:
623
  gr.Markdown("""
624
  # CKD-MultiVision
625
  ### Multimodal AI System for Early Chronic Kidney Disease Detection
 
708
  # ── Tab 2: CKD Health Coach ────────────────────────────────────────
709
  with gr.TabItem(" CKD Health Coach"):
710
  gr.Markdown("### Ask about diet, lifestyle, exercise, and kidney health.")
711
+ chatbot = gr.Chatbot(height=450)
712
  chat_input = gr.Textbox(placeholder="Ask a question about CKD...", label="Your Message")
713
  send_btn = gr.Button("Send", variant="primary")
714
  gr.Examples(
 
793
  if not message.strip():
794
  return history, ""
795
  bot_response = chat_with_groq(message, history)
796
+ history = history or []
797
+ history.append((message, bot_response))
798
  return history, ""
799
 
800
  send_btn.click(fn=respond, inputs=[chat_input, chatbot], outputs=[chatbot, chat_input])
801
  chat_input.submit(fn=respond, inputs=[chat_input, chatbot], outputs=[chatbot, chat_input])
802
 
803
  if __name__ == "__main__":
804
+ demo.launch(theme=gr.themes.Soft())