Spaces:
Sleeping
Sleeping
tonyliu404
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -399,21 +399,20 @@ if uploaded_image:
|
|
399 |
# Display the image
|
400 |
st.image(input_image, caption="Uploaded Image.", use_container_width=True)
|
401 |
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
print(fpredictions)
|
417 |
|
418 |
# call openai to pick the best classification result based on query
|
419 |
openAICall = [
|
@@ -459,6 +458,7 @@ if uploaded_image:
|
|
459 |
RAGresponse = get_response(predictions[0][0])
|
460 |
print("RAGresponse: ", RAGresponse)
|
461 |
display_response(RAGresponse)
|
|
|
462 |
elif uploaded_image is not None:
|
463 |
with col1:
|
464 |
# Open the image
|
|
|
399 |
# Display the image
|
400 |
st.image(input_image, caption="Uploaded Image.", use_container_width=True)
|
401 |
|
402 |
+
predictions = classifyImage(input_image)
|
403 |
+
print("Predictions: ", predictions)
|
404 |
+
fpredictions = ""
|
405 |
+
|
406 |
+
# Show the top predictions with percentages
|
407 |
+
st.write("Top Predictions:")
|
408 |
+
for class_name, confidence in predictions:
|
409 |
+
if int(confidence) > 0.05:
|
410 |
+
fpredictions += f"{class_name}: {confidence:.2f}%,"
|
411 |
+
if int(confidence) > 5:
|
412 |
+
class_name = class_name.replace("_", " ")
|
413 |
+
class_name = class_name.title()
|
414 |
+
st.markdown(f"*{class_name}*: {confidence:.2f}%")
|
415 |
+
print(fpredictions)
|
|
|
416 |
|
417 |
# call openai to pick the best classification result based on query
|
418 |
openAICall = [
|
|
|
458 |
RAGresponse = get_response(predictions[0][0])
|
459 |
print("RAGresponse: ", RAGresponse)
|
460 |
display_response(RAGresponse)
|
461 |
+
print("COL 2 WQEQOEWIQOIEWQWOIJQEWIJQWQEPJIEWQPIJEQPJIWEQPEWQEWQPOKWEQPOKWQEPOKWQOPKEWQOPKQQEWOPKWQEWQE")
|
462 |
elif uploaded_image is not None:
|
463 |
with col1:
|
464 |
# Open the image
|