Pavani2704 commited on
Commit
f464384
1 Parent(s): a68d627

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
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
- uploaded_files = st.file_uploader("Choose a image file",type=["jpg","jpeg"])
40
- text=st.text_area("Enter possible class names(comma separated")
41
- candidate_lables=[t.strip() for t in text.split(',')]
42
- if uploaded_files is not None:
43
- image = Image.open(requests.get(uploaded_files, stream=True).raw)
44
-
45
- outputs = imgpipe(image,candidate_lables)
46
-
47
- st.write(output["label"])
 
 
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: