Update app.py
Browse files
app.py
CHANGED
@@ -84,29 +84,37 @@ else:
|
|
84 |
st.error("Unsupported model selected.")
|
85 |
st.stop()
|
86 |
|
87 |
-
'''
|
88 |
-
vector_store = PGVector.from_existing_index(
|
89 |
-
embedding=embedding_model,
|
90 |
-
connection=engine,
|
91 |
-
collection_name="documents"
|
92 |
-
)
|
93 |
-
'''
|
94 |
#retriever = vector_store.as_retriever()
|
95 |
|
96 |
-
AI_PROMPT_TEMPLATE = """
|
97 |
-
You
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
3. Medications & Treatments - Provide common prescription and over-the-counter treatments.
|
103 |
-
4. Warnings & Emergencies - Always recommend consulting a licensed dermatologist.
|
104 |
-
5. Emergency Note - If symptoms worsen or include difficulty breathing, **advise calling 911 immediately.
|
105 |
|
106 |
Query: {question}
|
107 |
-
Relevant
|
108 |
-
|
|
|
109 |
"""
|
|
|
110 |
prompt_template = PromptTemplate(template=AI_PROMPT_TEMPLATE, input_variables=["question", "context"])
|
111 |
|
112 |
rag_chain = RetrievalQA.from_chain_type(
|
|
|
84 |
st.error("Unsupported model selected.")
|
85 |
st.stop()
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
#retriever = vector_store.as_retriever()
|
88 |
|
89 |
+
AI_PROMPT_TEMPLATE = """
|
90 |
+
You are DermBOT, a compassionate and knowledgeable AI Dermatology Assistant designed to educate users about skin-related health concerns with clarity, empathy, and precision.
|
91 |
+
|
92 |
+
Your goal is to respond like a well-informed human expert—balancing professionalism with warmth and reassurance.
|
93 |
+
|
94 |
+
When crafting responses:
|
95 |
+
- Begin with a clear, engaging summary of the condition or concern.
|
96 |
+
- Use short paragraphs for readability.
|
97 |
+
- Include bullet points or numbered lists where appropriate.
|
98 |
+
- Avoid overly technical terms unless explained simply.
|
99 |
+
- End with a helpful next step, such as lifestyle advice or when to see a doctor.
|
100 |
+
|
101 |
+
🩺 Response Structure:
|
102 |
+
1. **Overview** — Briefly introduce the condition or concern.
|
103 |
+
2. **Common Symptoms** — Describe noticeable signs in simple terms.
|
104 |
+
3. **Causes & Risk Factors** — Include genetic, lifestyle, and environmental aspects.
|
105 |
+
4. **Treatment Options** — Outline common OTC and prescription treatments.
|
106 |
+
5. **When to Seek Help** — Warn about symptoms that require urgent care.
|
107 |
|
108 |
+
Always encourage consulting a licensed dermatologist for personal diagnosis and treatment. For any breathing difficulties, serious infections, or rapid symptom worsening, advise calling emergency services immediately.
|
109 |
+
|
110 |
+
---
|
|
|
|
|
|
|
111 |
|
112 |
Query: {question}
|
113 |
+
Relevant Context: {context}
|
114 |
+
|
115 |
+
Your Response:
|
116 |
"""
|
117 |
+
|
118 |
prompt_template = PromptTemplate(template=AI_PROMPT_TEMPLATE, input_variables=["question", "context"])
|
119 |
|
120 |
rag_chain = RetrievalQA.from_chain_type(
|