tonyliu404 commited on
Commit
b8b7c59
·
verified ·
1 Parent(s): 7fc379c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -13
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
- st.write(f"Name: {response['name'].capitalize()}")
271
- st.write(f"Preparation Time: {response['minutes']} minutes")
272
- st.write(f"Description: {response['description'].capitalize()}")
273
- st.write(f"Tags: {', '.join(response['tags'])}")
274
- st.write("### Ingredients")
275
- st.write(", ".join([ingredient.capitalize() for ingredient in response['ingredients']]))
276
- st.write(f"Total Ingredients: {response['n_ingredients']}")
277
- st.write("### Nutrition Information (per serving)")
278
- st.write(", ".join(response['formatted_nutrition']))
279
- st.write(f"Number of Steps: {response['n_steps']}")
280
- st.write("### Steps")
281
- for step in response['formatted_steps']:
282
- st.write(capitalize_after_number(step))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)