Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import random
|
| 3 |
-
import pyttsx3
|
| 4 |
|
| 5 |
# Sample dataset for dish suggestions and recipes
|
| 6 |
recipe_data = {
|
|
@@ -146,12 +145,6 @@ def generate_weekly_diet(bmi_category):
|
|
| 146 |
|
| 147 |
return weekly_diet
|
| 148 |
|
| 149 |
-
# Text-to-Speech function
|
| 150 |
-
def speak_text(text):
|
| 151 |
-
engine = pyttsx3.init()
|
| 152 |
-
engine.say(text)
|
| 153 |
-
engine.runAndWait()
|
| 154 |
-
|
| 155 |
# Streamlit App Interface
|
| 156 |
st.title("Select an App to Use")
|
| 157 |
st.write("Choose one of the following options:")
|
|
@@ -180,10 +173,7 @@ if app_choice == "Cooking Suggestion App":
|
|
| 180 |
|
| 181 |
if selected_dish:
|
| 182 |
st.write(f"Recipe for {selected_dish}:")
|
| 183 |
-
|
| 184 |
-
st.write(recipe)
|
| 185 |
-
if st.button(f"Read Recipe for {selected_dish} Aloud", key=f"read_recipe_{selected_dish}"):
|
| 186 |
-
speak_text(recipe)
|
| 187 |
else:
|
| 188 |
st.write("No dishes found for the entered ingredients.")
|
| 189 |
else:
|
|
@@ -214,8 +204,6 @@ elif app_choice == "BMI Calculator and Diet Plan":
|
|
| 214 |
for meal in meals:
|
| 215 |
meal_text = f"- {meal['dish']} - {meal['calories']} Calories"
|
| 216 |
st.write(meal_text)
|
| 217 |
-
if st.button(f"Read {meal['dish']} Aloud", key=f"read_meal_{meal['dish']}"):
|
| 218 |
-
speak_text(meal_text)
|
| 219 |
else:
|
| 220 |
st.write("Sorry, we couldn't generate a diet plan for you.")
|
| 221 |
else:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import random
|
|
|
|
| 3 |
|
| 4 |
# Sample dataset for dish suggestions and recipes
|
| 5 |
recipe_data = {
|
|
|
|
| 145 |
|
| 146 |
return weekly_diet
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
# Streamlit App Interface
|
| 149 |
st.title("Select an App to Use")
|
| 150 |
st.write("Choose one of the following options:")
|
|
|
|
| 173 |
|
| 174 |
if selected_dish:
|
| 175 |
st.write(f"Recipe for {selected_dish}:")
|
| 176 |
+
st.write(recipe_data[selected_dish]["recipe"])
|
|
|
|
|
|
|
|
|
|
| 177 |
else:
|
| 178 |
st.write("No dishes found for the entered ingredients.")
|
| 179 |
else:
|
|
|
|
| 204 |
for meal in meals:
|
| 205 |
meal_text = f"- {meal['dish']} - {meal['calories']} Calories"
|
| 206 |
st.write(meal_text)
|
|
|
|
|
|
|
| 207 |
else:
|
| 208 |
st.write("Sorry, we couldn't generate a diet plan for you.")
|
| 209 |
else:
|