Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
from
|
4 |
-
from
|
5 |
-
from
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Streamlit page configuration
|
8 |
st.set_page_config(page_title="PHS - 2025 Healthcare System", layout="wide")
|
@@ -58,14 +62,6 @@ if choice == "Medication Management":
|
|
58 |
suggestions = suggest_medications(symptom)
|
59 |
st.info(f"Suggested Medications: {', '.join(suggestions)}")
|
60 |
|
61 |
-
st.subheader("Set Medication Dosage Schedule")
|
62 |
-
medicine_name = st.text_input("Enter Medicine Name for Dosage Schedule")
|
63 |
-
dosage = st.text_input("Enter Dosage (e.g., 2 pills daily)")
|
64 |
-
days = st.number_input("Enter Number of Days", min_value=1, max_value=30)
|
65 |
-
if st.button("Set Dosage Schedule"):
|
66 |
-
schedule_message = set_dosage_schedule(medicine_name, dosage, days)
|
67 |
-
st.success(schedule_message)
|
68 |
-
|
69 |
if choice == "Health Tracker":
|
70 |
st.subheader("Log Symptom")
|
71 |
symptom = st.text_input("Enter Symptom (e.g., headache, fatigue)")
|
@@ -85,23 +81,28 @@ if choice == "Health Tracker":
|
|
85 |
stats = track_health_stat(stat_type)
|
86 |
st.write(stats)
|
87 |
|
88 |
-
st.subheader("Personalized Health Advice")
|
89 |
if st.button("Get Personalized Health Advice"):
|
90 |
-
advice
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
if choice == "Lifestyle Recommendations":
|
94 |
st.subheader("Lifestyle Recommendations")
|
95 |
symptom = st.text_input("Enter Symptom (e.g., high blood pressure, diabetes)")
|
96 |
value = st.text_input("Enter Symptom Value")
|
97 |
-
if st.button("Get Lifestyle
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
st.info(
|
105 |
|
106 |
st.subheader("Fitness Tips")
|
107 |
if st.button("Get Fitness Tips"):
|
@@ -117,3 +118,4 @@ if choice == "Lifestyle Recommendations":
|
|
117 |
if st.button("Get Diet Tips"):
|
118 |
diet_tips = get_diet_tips()
|
119 |
st.info(diet_tips)
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import openai
|
3 |
+
from appointment_agent import book_appointment, cancel_appointment, follow_up_appointment
|
4 |
+
from medication_agent import set_medication_reminder, mark_medication_taken, suggest_medications
|
5 |
+
from health_tracker_agent import log_symptom, get_health_report, track_health_stat
|
6 |
+
from lifestyle_agent import recommend_lifestyle, get_fitness_tips, get_sleep_advice, get_diet_tips
|
7 |
+
|
8 |
+
# OpenAI API setup
|
9 |
+
openai.api_key = "your-openai-api-key" # Replace with your OpenAI API key
|
10 |
|
11 |
# Streamlit page configuration
|
12 |
st.set_page_config(page_title="PHS - 2025 Healthcare System", layout="wide")
|
|
|
62 |
suggestions = suggest_medications(symptom)
|
63 |
st.info(f"Suggested Medications: {', '.join(suggestions)}")
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
if choice == "Health Tracker":
|
66 |
st.subheader("Log Symptom")
|
67 |
symptom = st.text_input("Enter Symptom (e.g., headache, fatigue)")
|
|
|
81 |
stats = track_health_stat(stat_type)
|
82 |
st.write(stats)
|
83 |
|
84 |
+
st.subheader("Personalized Health Advice from AI")
|
85 |
if st.button("Get Personalized Health Advice"):
|
86 |
+
# AI-powered health advice using GPT
|
87 |
+
response = openai.Completion.create(
|
88 |
+
model="gpt-3.5-turbo",
|
89 |
+
prompt=f"Provide personalized health advice based on a symptom like {symptom} and value {value}.",
|
90 |
+
max_tokens=150
|
91 |
+
)
|
92 |
+
st.info(response.choices[0].text.strip())
|
93 |
|
94 |
if choice == "Lifestyle Recommendations":
|
95 |
st.subheader("Lifestyle Recommendations")
|
96 |
symptom = st.text_input("Enter Symptom (e.g., high blood pressure, diabetes)")
|
97 |
value = st.text_input("Enter Symptom Value")
|
98 |
+
if st.button("Get AI-based Lifestyle Recommendations"):
|
99 |
+
# AI-powered lifestyle suggestions
|
100 |
+
response = openai.Completion.create(
|
101 |
+
model="gpt-3.5-turbo",
|
102 |
+
prompt=f"Recommend a lifestyle modification plan for someone with {symptom} and value {value}.",
|
103 |
+
max_tokens=150
|
104 |
+
)
|
105 |
+
st.info(response.choices[0].text.strip())
|
106 |
|
107 |
st.subheader("Fitness Tips")
|
108 |
if st.button("Get Fitness Tips"):
|
|
|
118 |
if st.button("Get Diet Tips"):
|
119 |
diet_tips = get_diet_tips()
|
120 |
st.info(diet_tips)
|
121 |
+
|