Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -315,8 +315,7 @@ with st.expander("**What is FOOD CHAIN?**"):
|
|
315 |
Made by the Classify Crew: [Contact List](https://linktr.ee/classifycrew)
|
316 |
"""
|
317 |
)
|
318 |
-
|
319 |
-
st.warning("Please input an image and/or a prompt.", icon=':material/no_meals:')
|
320 |
#################
|
321 |
|
322 |
sample_RAG = {
|
@@ -391,7 +390,7 @@ with col2:
|
|
391 |
display_response(sample_RAG)
|
392 |
|
393 |
# Image Classification Section
|
394 |
-
if uploaded_image:
|
395 |
with col1:
|
396 |
# Open the image
|
397 |
input_image = Image.open(uploaded_image)
|
@@ -458,33 +457,34 @@ if uploaded_image:
|
|
458 |
RAGresponse = get_response(predictions[0][0])
|
459 |
print("RAGresponse: ", RAGresponse)
|
460 |
display_response(RAGresponse)
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
|
|
466 |
|
467 |
-
|
468 |
-
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
elif recipe_submit:
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
|
|
|
315 |
Made by the Classify Crew: [Contact List](https://linktr.ee/classifycrew)
|
316 |
"""
|
317 |
)
|
318 |
+
|
|
|
319 |
#################
|
320 |
|
321 |
sample_RAG = {
|
|
|
390 |
display_response(sample_RAG)
|
391 |
|
392 |
# Image Classification Section
|
393 |
+
if recipe_submit and uploaded_image:
|
394 |
with col1:
|
395 |
# Open the image
|
396 |
input_image = Image.open(uploaded_image)
|
|
|
457 |
RAGresponse = get_response(predictions[0][0])
|
458 |
print("RAGresponse: ", RAGresponse)
|
459 |
display_response(RAGresponse)
|
460 |
+
else:
|
461 |
+
st.warning("Please upload an image before submitting.", icon=':material/no_meals:')
|
462 |
+
# elif uploaded_image is not None:
|
463 |
+
# with col1:
|
464 |
+
# # Open the image
|
465 |
+
# input_image = Image.open(uploaded_image)
|
466 |
|
467 |
+
# # Display the image
|
468 |
+
# st.image(input_image, caption="Uploaded Image.", use_container_width=True)
|
469 |
|
470 |
+
# # Classify the image and display the result
|
471 |
+
# predictions = classifyImage(input_image)
|
472 |
+
# fpredictions = ""
|
473 |
|
474 |
+
# # Show the top predictions with percentages
|
475 |
+
# st.write("Top Predictions:")
|
476 |
+
# for class_name, confidence in predictions:
|
477 |
+
# if int(confidence) > 0.05:
|
478 |
+
# fpredictions += f"{class_name}: {confidence:.2f}%,"
|
479 |
+
# if int(confidence) > 5:
|
480 |
+
# class_name = class_name.replace("_", " ")
|
481 |
+
# class_name = class_name.title()
|
482 |
+
# st.markdown(f"*{class_name}*: {confidence:.2f}%")
|
483 |
+
# print(fpredictions)
|
484 |
+
|
485 |
+
# elif recipe_submit:
|
486 |
+
# with col2:
|
487 |
+
# response = get_response(query)
|
488 |
+
# print(response)
|
489 |
+
# display_response(response)
|
490 |
|