eaglelandsonce commited on
Commit
1d3b869
·
verified ·
1 Parent(s): 5f6055d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -47,6 +47,32 @@ def get_image_concepts(image_bytes):
47
  # Streamlit interface
48
  st.title("Image Detection with Clarifai")
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
51
  if uploaded_file is not None:
52
  image_bytes = uploaded_file.getvalue()
@@ -59,3 +85,5 @@ if uploaded_file is not None:
59
  st.write(f"{name}: {value}")
60
 
61
  # Run this with `streamlit run your_script_name.py`
 
 
 
47
  # Streamlit interface
48
  st.title("Image Detection with Clarifai")
49
 
50
+
51
+ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
52
+ if uploaded_file is not None:
53
+ image_bytes = uploaded_file.getvalue()
54
+ regions = get_image_concepts(image_bytes)
55
+
56
+ unique_names = set()
57
+ for region in regions:
58
+ for concept in region.data.concepts:
59
+ name = concept.name
60
+ # Add unique names to the set
61
+ unique_names.add(name)
62
+
63
+ # Display unique names
64
+ if unique_names:
65
+ st.write("Unique items detected in the image:")
66
+ for name in unique_names:
67
+ st.write(name)
68
+ else:
69
+ st.write("No unique items detected.")
70
+
71
+
72
+
73
+
74
+ """
75
+
76
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
77
  if uploaded_file is not None:
78
  image_bytes = uploaded_file.getvalue()
 
85
  st.write(f"{name}: {value}")
86
 
87
  # Run this with `streamlit run your_script_name.py`
88
+
89
+ """