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