Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -233,11 +233,13 @@ def display_response(response):
|
|
233 |
"""
|
234 |
Function to format a JSON response into Streamlit's `st.write()` format.
|
235 |
"""
|
236 |
-
|
|
|
|
|
237 |
if isinstance(response, str):
|
238 |
# Convert JSON string to dictionary if necessary
|
239 |
response = json.loads(response)
|
240 |
-
|
241 |
st.write("### Recipe Details")
|
242 |
st.write(f"**Name:** {response['name'].capitalize()}")
|
243 |
st.write(f"**Preparation Time:** {response['minutes']} minutes")
|
|
|
233 |
"""
|
234 |
Function to format a JSON response into Streamlit's `st.write()` format.
|
235 |
"""
|
236 |
+
if response == "[]":
|
237 |
+
st.write("No recipes found :(")
|
238 |
+
return
|
239 |
if isinstance(response, str):
|
240 |
# Convert JSON string to dictionary if necessary
|
241 |
response = json.loads(response)
|
242 |
+
|
243 |
st.write("### Recipe Details")
|
244 |
st.write(f"**Name:** {response['name'].capitalize()}")
|
245 |
st.write(f"**Preparation Time:** {response['minutes']} minutes")
|