Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,8 @@ import json
|
|
17 |
|
18 |
st.set_page_config(
|
19 |
page_title="Food Chain",
|
20 |
-
page_icon="🍴"
|
|
|
21 |
)
|
22 |
|
23 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
@@ -246,7 +247,7 @@ def display_response(response):
|
|
246 |
"""
|
247 |
Function to format a JSON response into Streamlit's `st.write()` format.
|
248 |
"""
|
249 |
-
if response == "[]":
|
250 |
st.write("No recipes found :(")
|
251 |
return
|
252 |
if isinstance(response, str):
|
@@ -328,11 +329,12 @@ with col1:
|
|
328 |
# Image Classification Section
|
329 |
if uploaded_image and recipe_submit:
|
330 |
with st.expander("**Food Classification**", expanded=True, icon=':material/search_insights:'):
|
331 |
-
st.title("Results: Image Classification")
|
332 |
-
# Open the image
|
333 |
-
input_image = Image.open(uploaded_image)
|
334 |
-
|
335 |
with col1:
|
|
|
|
|
|
|
|
|
|
|
336 |
# Display the image
|
337 |
st.image(input_image, caption="Uploaded Image.", use_container_width=True)
|
338 |
|
|
|
17 |
|
18 |
st.set_page_config(
|
19 |
page_title="Food Chain",
|
20 |
+
page_icon="🍴",
|
21 |
+
layout="wide"
|
22 |
)
|
23 |
|
24 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
|
|
247 |
"""
|
248 |
Function to format a JSON response into Streamlit's `st.write()` format.
|
249 |
"""
|
250 |
+
if response == "[]" or "":
|
251 |
st.write("No recipes found :(")
|
252 |
return
|
253 |
if isinstance(response, str):
|
|
|
329 |
# Image Classification Section
|
330 |
if uploaded_image and recipe_submit:
|
331 |
with st.expander("**Food Classification**", expanded=True, icon=':material/search_insights:'):
|
|
|
|
|
|
|
|
|
332 |
with col1:
|
333 |
+
st.title("Results: Image Classification")
|
334 |
+
|
335 |
+
# Open the image
|
336 |
+
input_image = Image.open(uploaded_image)
|
337 |
+
|
338 |
# Display the image
|
339 |
st.image(input_image, caption="Uploaded Image.", use_container_width=True)
|
340 |
|