Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,27 +21,22 @@ def get_result(img_path):
|
|
21 |
prediction = model.predict(img_input)
|
22 |
|
23 |
if prediction[0][0] < 0.5:
|
24 |
-
return "He is a Men
|
25 |
else:
|
26 |
-
return "She is a Women
|
27 |
|
28 |
|
29 |
-
|
30 |
-
st.title('Image Input and Display')
|
31 |
|
32 |
-
# Upload image
|
33 |
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
34 |
|
35 |
-
# If an image is uploaded, display it along with text
|
36 |
if uploaded_image is not None:
|
37 |
-
|
38 |
-
|
39 |
-
# output = get_result(uploaded_image)
|
40 |
-
|
41 |
image = Image.open(uploaded_image)
|
42 |
|
43 |
image_path = os.path.join(upload_folder, uploaded_image.name)
|
44 |
image.save(image_path)
|
45 |
output = get_result(image_path)
|
46 |
-
|
47 |
-
st.
|
|
|
|
21 |
prediction = model.predict(img_input)
|
22 |
|
23 |
if prediction[0][0] < 0.5:
|
24 |
+
return "He is a Men 🚹"
|
25 |
else:
|
26 |
+
return "She is a Women 🚺"
|
27 |
|
28 |
|
29 |
+
st.title('Let's detect the gender 🚹🚺')
|
|
|
30 |
|
|
|
31 |
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
32 |
|
|
|
33 |
if uploaded_image is not None:
|
34 |
+
|
|
|
|
|
|
|
35 |
image = Image.open(uploaded_image)
|
36 |
|
37 |
image_path = os.path.join(upload_folder, uploaded_image.name)
|
38 |
image.save(image_path)
|
39 |
output = get_result(image_path)
|
40 |
+
|
41 |
+
st.write(output)
|
42 |
+
st.image(image, use_container_width=True)
|