Upload 2 files
Browse files- app.py +12 -2
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -224,14 +224,24 @@ with gr.Blocks() as demo:
|
|
| 224 |
with gr.Tab("Medical QA"):
|
| 225 |
gr.Markdown("Ask questions about stress, mood, sleep, or general wellness.")
|
| 226 |
|
| 227 |
-
chatbot = gr.Chatbot(label="Medical QA")
|
| 228 |
msg = gr.Textbox(label="Your Question")
|
| 229 |
clear = gr.Button("Clear Chat")
|
| 230 |
|
| 231 |
def respond(message, history):
|
| 232 |
history = history or []
|
|
|
|
| 233 |
answer = rag_answer(message)
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
return "", history
|
| 236 |
|
| 237 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
| 224 |
with gr.Tab("Medical QA"):
|
| 225 |
gr.Markdown("Ask questions about stress, mood, sleep, or general wellness.")
|
| 226 |
|
| 227 |
+
chatbot = gr.Chatbot(label="Medical QA", type="messages")
|
| 228 |
msg = gr.Textbox(label="Your Question")
|
| 229 |
clear = gr.Button("Clear Chat")
|
| 230 |
|
| 231 |
def respond(message, history):
|
| 232 |
history = history or []
|
| 233 |
+
|
| 234 |
answer = rag_answer(message)
|
| 235 |
+
|
| 236 |
+
history.append({
|
| 237 |
+
"role": "user",
|
| 238 |
+
"content": message
|
| 239 |
+
})
|
| 240 |
+
history.append({
|
| 241 |
+
"role": "assistant",
|
| 242 |
+
"content": answer
|
| 243 |
+
})
|
| 244 |
+
|
| 245 |
return "", history
|
| 246 |
|
| 247 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
requirements.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
gradio==3.50.2
|
| 2 |
faiss-cpu
|
| 3 |
sentence-transformers
|
| 4 |
datasets
|
|
@@ -6,4 +5,5 @@ pandas
|
|
| 6 |
matplotlib
|
| 7 |
tqdm
|
| 8 |
groq
|
| 9 |
-
reportlab
|
|
|
|
|
|
|
|
|
| 1 |
faiss-cpu
|
| 2 |
sentence-transformers
|
| 3 |
datasets
|
|
|
|
| 5 |
matplotlib
|
| 6 |
tqdm
|
| 7 |
groq
|
| 8 |
+
reportlab
|
| 9 |
+
Pillow
|