Surendradjh commited on
Commit
70c408e
·
verified ·
1 Parent(s): 167269e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -79,16 +79,18 @@ input_choice = st.selectbox("Choose Input Method", ["📤 Upload Image", "📷 U
79
  if input_choice == "📤 Upload Image":
80
  uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
81
  if uploaded_file:
 
82
  image_input = resize_image(Image.open(uploaded_file))
83
- st.image(image_input, caption="Uploaded Image", use_container_width=True)
 
84
 
85
  with st.spinner("Analyzing with AI model..."):
86
  result_img, confidence, label = detect_and_predict(image_input)
87
 
88
- col1, col2 = st.columns(2)
89
- with col1:
90
- st.image(result_img, caption="Detection Output", use_container_width=True)
91
  with col2:
 
 
92
  if confidence is not None:
93
  st.metric("Confidence Score", f"{confidence*100:.2f}%")
94
  if "Mask" in label:
@@ -113,9 +115,9 @@ elif input_choice == "📷 Use Webcam":
113
 
114
  # col1, col2 = st.columns(2)
115
  with col2:
116
- resized_img = result_img.resize((200, 200))
117
 
118
- st.image(resized_img, caption="Detection Output", width=200)
119
  # st.image(result_img, caption="Detection Output", use_container_width=True).resize(200,200)
120
  # with col2:
121
  if confidence is not None:
 
79
  if input_choice == "📤 Upload Image":
80
  uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
81
  if uploaded_file:
82
+ col1, col2 = st.columns(2)
83
  image_input = resize_image(Image.open(uploaded_file))
84
+ with col1:
85
+ st.image(image_input, caption="Uploaded Image", width=400,height = 150)#use_container_width=True)
86
 
87
  with st.spinner("Analyzing with AI model..."):
88
  result_img, confidence, label = detect_and_predict(image_input)
89
 
90
+ # col1, col2 = st.columns(2)
 
 
91
  with col2:
92
+ st.image(result_img, caption="Detection Output", width=400,height = 150)#use_container_width=True)
93
+ # with col2:
94
  if confidence is not None:
95
  st.metric("Confidence Score", f"{confidence*100:.2f}%")
96
  if "Mask" in label:
 
115
 
116
  # col1, col2 = st.columns(2)
117
  with col2:
118
+ # resized_img = result_img.resize((200, 200))
119
 
120
+ st.image(resized_img, caption="Detection Output", width=400,height = 150)
121
  # st.image(result_img, caption="Detection Output", use_container_width=True).resize(200,200)
122
  # with col2:
123
  if confidence is not None: