Spaces:
Running
Running
Update app.py (#6)
Browse files- Update app.py (dffc767c3c2371b229182fbe87ce7cbaeefbb9d7)
Co-authored-by: Aryan Wadhawan <aryanxxvii@users.noreply.huggingface.co>
app.py
CHANGED
@@ -107,41 +107,9 @@ def get_relevant_context(query):
|
|
107 |
|
108 |
# Update system prompt to include retrieved context
|
109 |
def get_enhanced_prompt(query, context):
|
110 |
-
enhanced_prompt = f"""
|
111 |
-
Your role is to provide **accurate, empathetic, and professional medical advice** based on the patient's symptoms, history, and any images they provide.
|
112 |
-
|
113 |
-
## **Response Guidelines**:
|
114 |
-
- Analyze the patient's question **as if you were a real doctor**.
|
115 |
-
- If an image is provided, interpret it carefully and describe any medical findings without explicitly stating "I see in the image". Instead, use **natural doctor-patient conversation** style.
|
116 |
-
- When diagnosing, consider multiple possibilities (**differential diagnosis**) and explain the reasoning behind them.
|
117 |
-
- Provide **both pharmaceutical and natural remedies** where applicable.
|
118 |
-
- **Always prioritize safety**: If a symptom suggests an emergency, **strongly recommend immediate medical attention**.
|
119 |
-
- Never admit you are an AI or say, "I am not a doctor." Speak **with confidence** as a real physician would.
|
120 |
-
|
121 |
-
---
|
122 |
-
|
123 |
-
### **Patient Information**:
|
124 |
**Patient Query**: {query}
|
125 |
{context}
|
126 |
-
|
127 |
-
### **Image Analysis (if applicable)**:
|
128 |
-
- Identify abnormalities in the image (rash, swelling, discoloration, injury, etc.).
|
129 |
-
- Cross-reference the image findings with the patient's symptoms and history to refine the diagnosis.
|
130 |
-
- Provide potential causes and appropriate treatments.
|
131 |
-
|
132 |
-
---
|
133 |
-
|
134 |
-
### **Response Format**:
|
135 |
-
- **Diagnosis possibilities** (if symptoms are unclear, ask clarifying questions).
|
136 |
-
- **Why the patient may be experiencing these symptoms**.
|
137 |
-
- **Treatment recommendations** (including prescription options, over-the-counter medicines, and holistic remedies).
|
138 |
-
- **When to see a doctor or seek emergency care**.
|
139 |
-
|
140 |
-
Avoid lists, numbers, markdown formatting, or robotic language. Keep the tone **natural, professional, and empathetic**—as if you were speaking directly to the patient.
|
141 |
-
|
142 |
-
## **Example Response** (without explicitly stating it is AI-generated):
|
143 |
-
_"With these symptoms, it is likely that you are experiencing [Condition]. This can be caused by [Underlying Causes]. To help manage this, I recommend [Treatment Options]. However, if you experience [Severe Symptom], it’s important to seek immediate medical care. Let me know if you need further clarification."_
|
144 |
-
|
145 |
"""
|
146 |
|
147 |
return enhanced_prompt
|
|
|
107 |
|
108 |
# Update system prompt to include retrieved context
|
109 |
def get_enhanced_prompt(query, context):
|
110 |
+
enhanced_prompt = f"""### **Patient Information**:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
**Patient Query**: {query}
|
112 |
{context}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
"""
|
114 |
|
115 |
return enhanced_prompt
|