tonyliu404 commited on
Commit
e8bf91a
·
verified ·
1 Parent(s): f500d0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -268,24 +268,29 @@ def display_response(response):
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
  {chr(10).join([capitalize_after_number(step) for step in response['formatted_steps']])}
287
- """
288
- stx.scrollableTextbox(st.markdown(recipe_text), height=800)
 
289
 
290
  st.write(f"Name: {response['name'].capitalize()}")
291
  st.write(f"Preparation Time: {response['minutes']} minutes")
 
268
  # Convert JSON string to dictionary if necessary
269
  response = json.loads(response)
270
 
271
+ recipe_text = f"""**Name:** {response['name'].capitalize()}
272
+
273
  **Preparation Time:** {response['minutes']} minutes
274
+
275
  **Description:** {response['description'].capitalize()}
276
+
277
  **Tags:** {', '.join(response['tags'])}
278
+
279
  ### Ingredients
280
  {", ".join([ingredient.capitalize() for ingredient in response['ingredients']])}
281
+
282
  **Total Ingredients:** {response['n_ingredients']}
283
+
284
  ### Nutrition Information (per serving)
285
  {", ".join(response['formatted_nutrition'])}
286
+
287
  **Number of Steps:** {response['n_steps']}
288
+
289
  ### Steps
290
  {chr(10).join([capitalize_after_number(step) for step in response['formatted_steps']])}
291
+ """
292
+
293
+ stx.scrollableTextbox(recipe_text, height=800)
294
 
295
  st.write(f"Name: {response['name'].capitalize()}")
296
  st.write(f"Preparation Time: {response['minutes']} minutes")