Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,23 +3,6 @@ from rag_dspy import MedicalRAG
|
|
3 |
|
4 |
rag_chain = MedicalRAG()
|
5 |
|
6 |
-
def qa_bot(user_question, history):
|
7 |
-
history = history or []
|
8 |
-
if not user_question.strip():
|
9 |
-
return history, history
|
10 |
-
# Append user message
|
11 |
-
history.append({"role": "user", "content": user_question})
|
12 |
-
result = rag_chain.forward(user_question)
|
13 |
-
answer = result.final_answer
|
14 |
-
# Append assistant message
|
15 |
-
history.append({"role": "assistant", "content": answer})
|
16 |
-
return history, history
|
17 |
-
|
18 |
-
import gradio as gr
|
19 |
-
from rag_dspy import MedicalRAG
|
20 |
-
|
21 |
-
rag_chain = MedicalRAG()
|
22 |
-
|
23 |
sample_questions = [
|
24 |
"What are the most common symptoms of lupus?",
|
25 |
"How is type 2 diabetes usually managed in adults?",
|
@@ -43,8 +26,8 @@ body { background: #18181b !important; }
|
|
43 |
"""
|
44 |
|
45 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=css) as demo:
|
46 |
-
gr.Markdown("<h1 style='text-align: center; color: white;'
|
47 |
-
chatbot = gr.Chatbot(label="", elem_id="
|
48 |
state = gr.State([])
|
49 |
|
50 |
with gr.Row():
|
|
|
3 |
|
4 |
rag_chain = MedicalRAG()
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
sample_questions = [
|
7 |
"What are the most common symptoms of lupus?",
|
8 |
"How is type 2 diabetes usually managed in adults?",
|
|
|
26 |
"""
|
27 |
|
28 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=css) as demo:
|
29 |
+
gr.Markdown("<h1 style='text-align: center; color: white;'> Medical QA Bot</h1>")
|
30 |
+
chatbot = gr.Chatbot(label="", elem_id="Medical Chatbot", type="messages", height=400)
|
31 |
state = gr.State([])
|
32 |
|
33 |
with gr.Row():
|