Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -269,7 +269,7 @@ def display_response(response):
|
|
269 |
response = json.loads(response)
|
270 |
|
271 |
stx.scrollableTextbox(
|
272 |
-
|
273 |
**Name:** {response['name'].capitalize()}
|
274 |
**Preparation Time:** {response['minutes']} minutes
|
275 |
**Description:** {response['description'].capitalize()}
|
@@ -284,11 +284,25 @@ def display_response(response):
|
|
284 |
**Number of Steps:** {response['n_steps']}
|
285 |
|
286 |
### Steps
|
287 |
-
{
|
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)
|
294 |
for i in range(rows):
|
|
|
269 |
response = json.loads(response)
|
270 |
|
271 |
stx.scrollableTextbox(
|
272 |
+
f"""
|
273 |
**Name:** {response['name'].capitalize()}
|
274 |
**Preparation Time:** {response['minutes']} minutes
|
275 |
**Description:** {response['description'].capitalize()}
|
|
|
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")
|
294 |
+
st.write(f"Description: {response['description'].capitalize()}")
|
295 |
+
st.write(f"Tags: {', '.join(response['tags'])}")
|
296 |
+
st.write("### Ingredients")
|
297 |
+
st.write(", ".join([ingredient.capitalize() for ingredient in response['ingredients']]))
|
298 |
+
st.write(f"Total Ingredients: {response['n_ingredients']}")
|
299 |
+
st.write("### Nutrition Information (per serving)")
|
300 |
+
st.write(", ".join(response['formatted_nutrition']))
|
301 |
+
st.write(f"Number of Steps: {response['n_steps']}")
|
302 |
+
st.write("### Steps")
|
303 |
+
for step in response['formatted_steps']:
|
304 |
+
st.write(capitalize_after_number(step))
|
305 |
+
|
306 |
def display_dishes_in_grid(dishes, cols=3):
|
307 |
rows = len(dishes) // cols + int(len(dishes) % cols > 0)
|
308 |
for i in range(rows):
|