Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ import matplotlib.pyplot as plt
|
|
18 |
from matplotlib.colors import LinearSegmentedColormap
|
19 |
import textwrap
|
20 |
import plotly.graph_objects as go
|
|
|
21 |
|
22 |
st.set_page_config(
|
23 |
page_title="Food Chain",
|
@@ -266,20 +267,24 @@ def display_response(response):
|
|
266 |
if isinstance(response, str):
|
267 |
# Convert JSON string to dictionary if necessary
|
268 |
response = json.loads(response)
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
|
|
283 |
|
284 |
def display_dishes_in_grid(dishes, cols=3):
|
285 |
rows = len(dishes) // cols + int(len(dishes) % cols > 0)
|
|
|
18 |
from matplotlib.colors import LinearSegmentedColormap
|
19 |
import textwrap
|
20 |
import plotly.graph_objects as go
|
21 |
+
import streamlit_scrollable_textbox as stx
|
22 |
|
23 |
st.set_page_config(
|
24 |
page_title="Food Chain",
|
|
|
267 |
if isinstance(response, str):
|
268 |
# Convert JSON string to dictionary if necessary
|
269 |
response = json.loads(response)
|
270 |
+
|
271 |
+
stx.scrollableTextbox(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 |
|
289 |
def display_dishes_in_grid(dishes, cols=3):
|
290 |
rows = len(dishes) // cols + int(len(dishes) % cols > 0)
|