Spaces:
Runtime error
Runtime error
Yova Kementchedjhieva
commited on
Commit
•
131543d
1
Parent(s):
04a3fe5
update
Browse files- app.py +5 -5
- templates/index.html +1 -1
app.py
CHANGED
@@ -15,13 +15,13 @@ def generate_recipe(ingredients):
|
|
15 |
|
16 |
def main():
|
17 |
st.title("Recipe Generator")
|
18 |
-
ingredients_input = st.text_input("Enter ingredients
|
19 |
|
20 |
-
if st.button("
|
21 |
ingredients = ingredients_input.split(',')
|
22 |
-
ingredients = [ingredient.strip() for ingredient in ingredients]
|
23 |
-
|
24 |
-
if not ingredients:
|
25 |
st.error("Please provide at least one ingredient.")
|
26 |
else:
|
27 |
recipe = generate_recipe(ingredients)
|
|
|
15 |
|
16 |
def main():
|
17 |
st.title("Recipe Generator")
|
18 |
+
ingredients_input = st.text_input("Enter the ingredients you have, separated by a comma:")
|
19 |
|
20 |
+
if st.button("Show me a recipe"):
|
21 |
ingredients = ingredients_input.split(',')
|
22 |
+
ingredients = [ingredient.strip() for ingredient in ingredients if len(ingredient.strip())]
|
23 |
+
|
24 |
+
if not len(ingredients):
|
25 |
st.error("Please provide at least one ingredient.")
|
26 |
else:
|
27 |
recipe = generate_recipe(ingredients)
|
templates/index.html
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
<p>Please provide a list of your available ingredients, separated by a comma</p>
|
55 |
<form id="ingredientsForm">
|
56 |
<input type="text" id="ingredientsInput" placeholder="Enter ingredients (comma-separated)" required>
|
57 |
-
<button type="submit">
|
58 |
</form>
|
59 |
<div id="recipe"></div>
|
60 |
</div>
|
|
|
54 |
<p>Please provide a list of your available ingredients, separated by a comma</p>
|
55 |
<form id="ingredientsForm">
|
56 |
<input type="text" id="ingredientsInput" placeholder="Enter ingredients (comma-separated)" required>
|
57 |
+
<button type="submit">Show me a recipe</button>
|
58 |
</form>
|
59 |
<div id="recipe"></div>
|
60 |
</div>
|