Pavani2704 commited on
Commit
f071ce0
1 Parent(s): 5f16603

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -38,15 +38,16 @@ elif option == "Image Classification":
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:
 
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 st.button("Submit"):
42
+ if uploaded_file is not None and text:
43
+ candidate_labels = [t.strip() for t in text.split(',')]
44
+ image = Image.open(uploaded_file)
45
+ st.image(image, caption="Uploaded Image", use_column_width=True)
46
+ classification_result = imgpipe(image, candidate_labels)
47
+ for result in classification_result:
48
+ st.write(f"Label: {result['label']}, Score: {result['score']}")
49
+ else:
50
+ st.write("Please upload an image file and enter class names.")
51
 
52
 
53
  else: