tonyliu404 commited on
Commit
9a3541b
·
verified ·
1 Parent(s): 1d93d68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- print("ORIGINAL RESPONSE", response)
 
 
237
  if isinstance(response, str):
238
  # Convert JSON string to dictionary if necessary
239
  response = json.loads(response)
240
- print("JSON CONVERTED RESPONSE: ", response)
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")