Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,6 @@ import matplotlib.pyplot as plt
|
|
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",
|
@@ -268,30 +267,6 @@ def display_response(response):
|
|
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")
|
297 |
st.write(f"Description: {response['description'].capitalize()}")
|
|
|
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",
|
|
|
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()}")
|