Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,7 @@ st.markdown("""
|
|
| 62 |
""", unsafe_allow_html=True)
|
| 63 |
|
| 64 |
# Set title and subtitle
|
| 65 |
-
st.title("Welcome to Your Menstrual Cycle
|
| 66 |
st.subheader("Align with Your Body")
|
| 67 |
|
| 68 |
# Input fields for user parameters
|
|
@@ -78,7 +78,7 @@ def determine_cycle_phase(days_menstruation, days_cycle, last_period_start_date)
|
|
| 78 |
cycle_day = (today - last_period_start_date).days % days_cycle
|
| 79 |
|
| 80 |
if cycle_day < days_menstruation:
|
| 81 |
-
return "
|
| 82 |
elif cycle_day < days_menstruation + (days_cycle - days_menstruation) // 2:
|
| 83 |
return "Follicular Phase (Spring)"
|
| 84 |
elif cycle_day < days_cycle - (days_cycle - days_menstruation) // 2:
|
|
@@ -87,50 +87,44 @@ def determine_cycle_phase(days_menstruation, days_cycle, last_period_start_date)
|
|
| 87 |
return "Luteal Phase (Autumn)"
|
| 88 |
|
| 89 |
# Submit button
|
| 90 |
-
if st.button("
|
| 91 |
-
if days_menstruation and days_cycle and
|
| 92 |
# Determine current cycle phase
|
| 93 |
current_phase = determine_cycle_phase(days_menstruation, days_cycle, last_period_start_date)
|
| 94 |
|
| 95 |
# Fetch relevant information from the PDF
|
|
|
|
| 96 |
if "Menstruationsphase" in pdf_text and "Ernährung" in pdf_text:
|
| 97 |
phase_info = pdf_text.split("Menstruationsphase")[1].split("Ernährung")[0]
|
| 98 |
else:
|
| 99 |
phase_info = "I am sorry I am only an Assistant and I advise you to call an expert."
|
| 100 |
|
| 101 |
-
#
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
else:
|
| 112 |
st.error("Please fill in all the fields.")
|
| 113 |
|
| 114 |
-
# Example knowledge base information
|
| 115 |
-
st.header("Menstrual Cycle Knowledge Base")
|
| 116 |
-
st.write("""
|
| 117 |
-
The menstrual cycle is a natural process that occurs in the female body to prepare for a potential pregnancy. It consists of several phases:
|
| 118 |
-
- **Menstrual Phase:** This is the phase where the uterine lining sheds, causing bleeding.
|
| 119 |
-
- **Follicular Phase:** The body prepares for ovulation by growing follicles in the ovaries.
|
| 120 |
-
- **Ovulation Phase:** An egg is released from the ovary, making it the most fertile phase.
|
| 121 |
-
- **Luteal Phase:** The body prepares for a possible pregnancy or the next menstrual cycle.
|
| 122 |
-
|
| 123 |
-
**Tips for Managing Different Phases:**
|
| 124 |
-
- **Menstrual Phase:** Rest and engage in gentle activities like reading or journaling.
|
| 125 |
-
- **Follicular Phase:** Plan new projects and gradually increase your activity.
|
| 126 |
-
- **Ovulation Phase:** Use your high energy for social and professional networking.
|
| 127 |
-
- **Luteal Phase:** Focus on completing tasks and integrate stress-reducing activities like yoga.
|
| 128 |
-
|
| 129 |
-
Remember, your body and cycle are unique. Embrace and understand your cycle to align better with your body's natural rhythms.
|
| 130 |
-
""")
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
st.header("References")
|
| 135 |
st.write("""
|
| 136 |
-
This is a beta-version of 2024-06-02 and we are happy to assist you with the updated version.
|
|
|
|
|
|
|
|
|
| 62 |
""", unsafe_allow_html=True)
|
| 63 |
|
| 64 |
# Set title and subtitle
|
| 65 |
+
st.title("Welcome to Your Menstrual Cycle Tracker")
|
| 66 |
st.subheader("Align with Your Body")
|
| 67 |
|
| 68 |
# Input fields for user parameters
|
|
|
|
| 78 |
cycle_day = (today - last_period_start_date).days % days_cycle
|
| 79 |
|
| 80 |
if cycle_day < days_menstruation:
|
| 81 |
+
return "Menstrual Phase (Winter)"
|
| 82 |
elif cycle_day < days_menstruation + (days_cycle - days_menstruation) // 2:
|
| 83 |
return "Follicular Phase (Spring)"
|
| 84 |
elif cycle_day < days_cycle - (days_cycle - days_menstruation) // 2:
|
|
|
|
| 87 |
return "Luteal Phase (Autumn)"
|
| 88 |
|
| 89 |
# Submit button
|
| 90 |
+
if st.button("Tell Me About My Cycle"):
|
| 91 |
+
if days_menstruation and days_cycle and last_period_start_date:
|
| 92 |
# Determine current cycle phase
|
| 93 |
current_phase = determine_cycle_phase(days_menstruation, days_cycle, last_period_start_date)
|
| 94 |
|
| 95 |
# Fetch relevant information from the PDF
|
| 96 |
+
phase_info = ""
|
| 97 |
if "Menstruationsphase" in pdf_text and "Ernährung" in pdf_text:
|
| 98 |
phase_info = pdf_text.split("Menstruationsphase")[1].split("Ernährung")[0]
|
| 99 |
else:
|
| 100 |
phase_info = "I am sorry I am only an Assistant and I advise you to call an expert."
|
| 101 |
|
| 102 |
+
# Display current phase information
|
| 103 |
+
st.subheader(f"Current Phase: {current_phase}")
|
| 104 |
+
st.write(phase_info)
|
| 105 |
+
|
| 106 |
+
# Knowledge base information
|
| 107 |
+
st.header("Menstrual Cycle Knowledge Base")
|
| 108 |
+
st.write("""
|
| 109 |
+
The menstrual cycle is a natural process that occurs in the female body to prepare for a potential pregnancy. It consists of several phases:
|
| 110 |
+
- **Menstrual Phase:** This is the phase where the uterine lining sheds, causing bleeding.
|
| 111 |
+
- **Follicular Phase:** The body prepares for ovulation by growing follicles in the ovaries.
|
| 112 |
+
- **Ovulation Phase:** An egg is released from the ovary, making it the most fertile phase.
|
| 113 |
+
- **Luteal Phase:** The body prepares for a possible pregnancy or the next menstrual cycle.
|
| 114 |
+
|
| 115 |
+
**Tips for Managing Different Phases:**
|
| 116 |
+
- **Menstrual Phase:** Rest and engage in gentle activities like reading or journaling.
|
| 117 |
+
- **Follicular Phase:** Plan new projects and gradually increase your activity.
|
| 118 |
+
- **Ovulation Phase:** Use your high energy for social and professional networking.
|
| 119 |
+
- **Luteal Phase:** Focus on completing tasks and integrate stress-reducing activities like yoga.
|
| 120 |
|
| 121 |
+
Remember, your body and cycle are unique. Embrace and understand your cycle to align better with your body's natural rhythms.
|
| 122 |
+
""")
|
| 123 |
else:
|
| 124 |
st.error("Please fill in all the fields.")
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
st.header("References")
|
| 127 |
st.write("""
|
| 128 |
+
This is a beta-version of 2024-06-02 and we are happy to assist you with the updated version.
|
| 129 |
+
Greetings Nur M.
|
| 130 |
+
""")
|