chido10 commited on
Commit
3317841
·
verified ·
1 Parent(s): 59f76d8

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +64 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import google.generativeai as genai
3
+ import os
4
+ from dotenv import load_dotenv
5
+ load_dotenv()
6
+
7
+ # Configure the API using the key from environment variables
8
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
9
+
10
+ # Function to get response from the Gemini model
11
+ def get_gemini_response(input_text):
12
+ model = genai.GenerativeModel('gemini-pro')
13
+ response = model.generate_content(input_text)
14
+ return response.text
15
+
16
+ # Streamlit UI setup
17
+ st.title("CVD Prediction AI BOT")
18
+ st.markdown("Enhancing Cardiovascular Disease Prediction with LLM: <span style='color:#009933;'>**A Prototype Using Human Vital Signs**</span><br>by <span style='color:#ff6600;'>***Chidozie Louis Uzoegwu***</span>", unsafe_allow_html=True)
19
+
20
+ # Patient Information Form
21
+ st.write ("""
22
+ ## Normal Vital Signs in Adults
23
+ | Vital Sign | Normal Range |
24
+ |--------------------|-------------------------|
25
+ | Body Temperature | 98.6°F (37°C) |
26
+ | Heart Rate | 60-100 beats per minute |
27
+ | Respiratory Rate | 12-18 breaths per minute|
28
+ | Blood Oxygen | 95-100% |
29
+ | Blood Pressure | 120/80 mm Hg |
30
+ """)
31
+ ("Patient Information:")
32
+ age = st.slider("Age", min_value=1, max_value=100, value=30)
33
+ gender = st.radio("Gender", ["Male", "Female"])
34
+ heart_rate = st.slider("Heart Rate (beats per minute)", min_value=30, max_value=200, value=75)
35
+ respiration_rate = st.slider("Respiration Rate (breaths per minute)", min_value=5, max_value=40, value=15)
36
+ body_temperature = st.slider("Body Temperature (°C)", min_value=30.0, max_value=45.0, value=37.0, step=0.1)
37
+ blood_pressure_systolic = st.slider("Blood Pressure - Systolic (mm Hg)", min_value=50, max_value=250, value=120)
38
+ blood_pressure_diastolic = st.slider("Blood Pressure - Diastolic (mm Hg)", min_value=30, max_value=150, value=80)
39
+ oxygen_saturation = st.slider("Blood Oxygen Saturation (%)", min_value=50, max_value=100, value=98)
40
+
41
+ submit = st.button('Predict CVD')
42
+
43
+ if submit:
44
+ # Prepare the input prompt using the patient information
45
+ input_prompt = f"""
46
+ Given the patient's information, assess the risk of cardiovascular disease (CVD). Patient details:
47
+ - Age: {age}
48
+ - Gender: {gender}
49
+ - Heart Rate: {heart_rate} bpm
50
+ - Respiration Rate: {respiration_rate} breaths per minute
51
+ - Body Temperature: {body_temperature} °C
52
+ - Blood Pressure - Systolic: {blood_pressure_systolic} mm Hg
53
+ - Blood Pressure - Diastolic: {blood_pressure_diastolic} mm Hg
54
+ - Blood Oxygen Saturation: {oxygen_saturation}%
55
+
56
+ Provide an analysis in a simple table based on vital signs and physiological characteristics, focusing on measures such as heart rate, respiration rate, body temperature, blood pressure, and oxygen saturation.
57
+ Consider the normal ranges and their significance in assessing CVD risk.
58
+ Also, explore the use of machine learning algorithms in predicting vital signs for CVD monitoring and intervention.
59
+ Include insights on the role of these vital signs in evaluating the basic operations of the human body and their importance in clinical examinations and long-term CVD risk assessment.
60
+ As part of the conclusion make massive point about enhancing the development and implementation of an innovative Internet of Medical Things (IoMT) -based remote patient monitoring system.
61
+ Lastly include advice, such as see doctor, eat healthy, exercise, etc, depending on the level of critical assessment.
62
+ """
63
+ response = get_gemini_response(input_prompt)
64
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv