Spaces:
Sleeping
Sleeping
Update app.py with modified prompt and added html content
Browse files
app.py
CHANGED
@@ -47,25 +47,45 @@ vis_model = genai.GenerativeModel(
|
|
47 |
|
48 |
# System Prompt
|
49 |
system_prompt = """
|
50 |
-
Model: "As a trusted medical chatbot, your role is crucial in providing accurate information and guidance to users seeking
|
51 |
-
You will be presented with symptoms, medical history, or queries related to various health concerns, and your task is to offer insightful analysis, recommendations, and information to aid users in understanding their health conditions and making informed decisions.
|
52 |
|
53 |
**Analysis Guidelines:**
|
54 |
|
55 |
-
1. **
|
56 |
-
2. **
|
57 |
-
3. **
|
58 |
-
4. **
|
59 |
-
5. **
|
60 |
-
6. **
|
61 |
|
62 |
**Refusal Policy:**
|
63 |
-
If the user provides information
|
64 |
|
65 |
-
Your role as a medical chatbot is to
|
66 |
|
67 |
"""
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Image to Base 64 Converter Function
|
71 |
def image_to_base64(image_path):
|
@@ -140,7 +160,13 @@ def llm_response(history, text, img):
|
|
140 |
|
141 |
|
142 |
# Interface Code using Gradio
|
143 |
-
with gr.Blocks() as app:
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
with gr.Row():
|
145 |
# Image UI
|
146 |
image_box = gr.Image(type="filepath")
|
|
|
47 |
|
48 |
# System Prompt
|
49 |
system_prompt = """
|
50 |
+
Model: "As a trusted medical chatbot, your role is crucial in providing accurate information and guidance to users seeking assistance in reducing preventable deaths of newborns and children under 5 years of age, as well as supporting the health and well-being of pregnant mothers and women. Your focus will be on addressing queries related to neonatal and under-five mortality rates, maternal health, and women's health issues, offering insights and recommendations to support these global health goals.
|
|
|
51 |
|
52 |
**Analysis Guidelines:**
|
53 |
|
54 |
+
1. **Data Evaluation:** Assess data related to neonatal and under-five mortality rates, maternal health indicators, and women's health issues to understand the current situation and identify areas for improvement.
|
55 |
+
2. **Risk Factors Identification:** Identify risk factors contributing to neonatal and under-five deaths, as well as maternal health complications, considering factors such as access to healthcare, nutrition, socio-economic status, and maternal age.
|
56 |
+
3. **Intervention Discussion:** Discuss potential interventions and strategies aimed at reducing neonatal and under-five mortality rates, improving maternal health outcomes, and addressing women's health issues, including healthcare initiatives, vaccination programs, nutrition interventions, maternal health initiatives, and reproductive health services.
|
57 |
+
4. **Community Engagement:** Explore opportunities for community engagement and education to raise awareness about preventive measures, health-seeking behaviors during pregnancy, and women's health issues.
|
58 |
+
5. **Monitoring and Evaluation:** Propose methods for monitoring progress and evaluating the effectiveness of interventions in reducing neonatal and under-five mortality rates, improving maternal health outcomes, and addressing women's health issues.
|
59 |
+
6. **Collaboration:** Emphasize the importance of collaboration with healthcare professionals, policymakers, community stakeholders, and organizations focusing on maternal and child health to achieve the goal of reducing preventable deaths among newborns and children under 5 years of age, as well as improving maternal and women's health outcomes.
|
60 |
|
61 |
**Refusal Policy:**
|
62 |
+
If the user provides information not related to reducing neonatal and under-five mortality rates, maternal health, or women's health issues, kindly inform them that this chatbot is designed to address queries specific to these global health goals. Encourage them to seek assistance from appropriate sources for other inquiries.
|
63 |
|
64 |
+
Your role as a medical chatbot is to provide valuable insights and recommendations to support efforts in reducing preventable deaths of newborns and children under 5 years of age, as well as improving maternal and women's health outcomes. Proceed to assist users with their queries, ensuring clarity, empathy, and accuracy in your responses."
|
65 |
|
66 |
"""
|
67 |
|
68 |
+
# HTML Content for the Interface
|
69 |
+
TITLE = """<h1 align="center">Well Being π¬</h1>"""
|
70 |
+
SUBTITLE = """<h2 align="center">End Preventable Child Deaths: Join the Global Effort to Save Children's Lives!</h2>"""
|
71 |
+
DUPLICATE = """
|
72 |
+
<div
|
73 |
+
style="
|
74 |
+
text-align: center;
|
75 |
+
display: flex;
|
76 |
+
justify-content: center;
|
77 |
+
align-items: center;
|
78 |
+
"
|
79 |
+
>
|
80 |
+
<p>
|
81 |
+
We aim to reduce child mortality globally. πΆπ» Our goals are under-5
|
82 |
+
mortality of β€25 per 1,000 live births π and neonatal mortality of β€12 per
|
83 |
+
1,000. π This requires preventing newborn and early childhood deaths
|
84 |
+
worldwide. β Together, we can give every child a healthy start to life! π
|
85 |
+
</p>
|
86 |
+
</div>
|
87 |
+
"""
|
88 |
+
|
89 |
|
90 |
# Image to Base 64 Converter Function
|
91 |
def image_to_base64(image_path):
|
|
|
160 |
|
161 |
|
162 |
# Interface Code using Gradio
|
163 |
+
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
164 |
+
|
165 |
+
# Add HTML Content
|
166 |
+
gr.HTML(TITLE)
|
167 |
+
gr.HTML(SUBTITLE)
|
168 |
+
gr.HTML(DUPLICATE)
|
169 |
+
|
170 |
with gr.Row():
|
171 |
# Image UI
|
172 |
image_box = gr.Image(type="filepath")
|