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