Spaces:
Sleeping
Sleeping
Pavani2704
commited on
Commit
•
f464384
1
Parent(s):
a68d627
Update app.py
Browse files
app.py
CHANGED
@@ -36,15 +36,17 @@ elif option == "Age Detection":
|
|
36 |
elif option == "Image Classification":
|
37 |
st.title("Welcome to object detection")
|
38 |
|
39 |
-
|
40 |
-
text=st.text_area("Enter possible class names(comma
|
41 |
-
|
42 |
-
|
43 |
-
image = Image.open(
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
|
50 |
else:
|
|
|
36 |
elif option == "Image Classification":
|
37 |
st.title("Welcome to object detection")
|
38 |
|
39 |
+
uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
|
40 |
+
text = st.text_area("Enter possible class names (comma-separated)")
|
41 |
+
if uploaded_file is not None and text:
|
42 |
+
candidate_labels = [t.strip() for t in text.split(',')]
|
43 |
+
image = Image.open(uploaded_file)
|
44 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
45 |
+
classification_result = imgpipe(image, candidate_labels)
|
46 |
+
for result in classification_result:
|
47 |
+
st.write(f"Label: {result['label']}, Score: {result['score']}")
|
48 |
+
else:
|
49 |
+
st.write("Please upload an image file and enter class names.")
|
50 |
|
51 |
|
52 |
else:
|