tonyliu404 commited on
Commit
e499849
·
verified ·
1 Parent(s): 7dbcf77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
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
- stx.scrollableTextbox(
272
- 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
- {"\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")