tonyliu404 commited on
Commit
4b7b969
·
verified ·
1 Parent(s): f20f9cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
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
- if recipe_submit:
403
- predictions = classifyImage(input_image)
404
- print("Predictions: ", predictions)
405
- fpredictions = ""
406
-
407
- # Show the top predictions with percentages
408
- st.write("Top Predictions:")
409
- for class_name, confidence in predictions:
410
- if int(confidence) > 0.05:
411
- fpredictions += f"{class_name}: {confidence:.2f}%,"
412
- if int(confidence) > 5:
413
- class_name = class_name.replace("_", " ")
414
- class_name = class_name.title()
415
- st.markdown(f"*{class_name}*: {confidence:.2f}%")
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