darkmortal commited on
Commit
6ef3649
·
verified ·
1 Parent(s): 4575457

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -24,14 +24,15 @@ if file_name is not None:
24
  image = Image.open(file_name)
25
  col1.image(image, use_column_width=True)
26
 
27
- label = st.text_input("What to look for in the image?", "Cats")
28
-
29
- predictions = scan_image(image, label)
30
-
31
- col2.header("Probabilities")
32
- for key, value in predictions[1]:
33
- col2.subheader(f"{ key }: { round(value * 100, 1)}%")
34
-
35
- if predictions[1]:
36
- st.header("The object is present in the given image")
37
- else: st.header("The object is not found in the given image")
 
 
24
  image = Image.open(file_name)
25
  col1.image(image, use_column_width=True)
26
 
27
+ label = st.text_input("What to look for in the image?")
28
+
29
+ if st.button("Scan Image"):
30
+ predictions = scan_image(image, label)
31
+
32
+ col2.header("Probabilities")
33
+ for key in predictions[1].keys():
34
+ col2.subheader(f"{ key }: { round(predictions[1][key] * 100, 1)}%")
35
+
36
+ if predictions[0]:
37
+ st.header("The object is present in the given image")
38
+ else: st.header("The object is not found in the given image")