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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -25,14 +25,16 @@ if file_name is not None:
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")
 
 
 
25
  col1.image(image, use_column_width=True)
26
 
27
  label = st.text_input("What to look for in the image?")
28
+ if label == '':
29
+ st.warning('Please enter a object label', icon="⚠️")
30
+ else:
31
+ if st.button("Scan Image"):
32
+ predictions = scan_image(image, label)
33
+
34
+ col2.header("Probabilities")
35
+ for key in predictions[1].keys():
36
+ col2.subheader(f"{ key }: { round(predictions[1][key] * 100, 1)}%")
37
+
38
+ if predictions[0]:
39
+ st.header("The object is present in the given image")
40
+ else: st.header("The object is not found in the given image")