Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -267,19 +267,36 @@ def display_response(response):
|
|
267 |
# Convert JSON string to dictionary if necessary
|
268 |
response = json.loads(response)
|
269 |
|
270 |
-
|
271 |
-
st.
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
st.write(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
def display_dishes_in_grid(dishes, cols=3):
|
285 |
rows = len(dishes) // cols + int(len(dishes) % cols > 0)
|
|
|
267 |
# Convert JSON string to dictionary if necessary
|
268 |
response = json.loads(response)
|
269 |
|
270 |
+
|
271 |
+
with st.container(height=800):
|
272 |
+
st.write(f"Name: {response['name'].capitalize()}")
|
273 |
+
st.write(f"Preparation Time: {response['minutes']} minutes")
|
274 |
+
st.write(f"Description: {response['description'].capitalize()}")
|
275 |
+
st.write(f"Tags: {', '.join(response['tags'])}")
|
276 |
+
st.write("### Ingredients")
|
277 |
+
st.write(", ".join([ingredient.capitalize() for ingredient in response['ingredients']]))
|
278 |
+
st.write(f"Total Ingredients: {response['n_ingredients']}")
|
279 |
+
st.write("### Nutrition Information (per serving)")
|
280 |
+
st.write(", ".join(response['formatted_nutrition']))
|
281 |
+
st.write(f"Number of Steps: {response['n_steps']}")
|
282 |
+
st.write("### Steps")
|
283 |
+
for step in response['formatted_steps']:
|
284 |
+
st.write(capitalize_after_number(step))
|
285 |
+
|
286 |
+
|
287 |
+
# st.write(f"Name: {response['name'].capitalize()}")
|
288 |
+
# st.write(f"Preparation Time: {response['minutes']} minutes")
|
289 |
+
# st.write(f"Description: {response['description'].capitalize()}")
|
290 |
+
# st.write(f"Tags: {', '.join(response['tags'])}")
|
291 |
+
# st.write("### Ingredients")
|
292 |
+
# st.write(", ".join([ingredient.capitalize() for ingredient in response['ingredients']]))
|
293 |
+
# st.write(f"Total Ingredients: {response['n_ingredients']}")
|
294 |
+
# st.write("### Nutrition Information (per serving)")
|
295 |
+
# st.write(", ".join(response['formatted_nutrition']))
|
296 |
+
# st.write(f"Number of Steps: {response['n_steps']}")
|
297 |
+
# st.write("### Steps")
|
298 |
+
# for step in response['formatted_steps']:
|
299 |
+
# st.write(capitalize_after_number(step))
|
300 |
|
301 |
def display_dishes_in_grid(dishes, cols=3):
|
302 |
rows = len(dishes) // cols + int(len(dishes) % cols > 0)
|