Spaces:
Sleeping
Sleeping
dron3flyv3r
commited on
Commit
·
12bc61f
1
Parent(s):
8c92bed
Update app.py
Browse files
app.py
CHANGED
@@ -13,20 +13,21 @@ classes = checkpoint['classes']
|
|
13 |
tran = checkpoint['transform']
|
14 |
|
15 |
# upload image
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
if uploaded_file is not None:
|
20 |
-
img = Image.open(uploaded_file)
|
21 |
-
st.image(img, caption='Uploaded Image.', use_column_width=True)
|
22 |
-
label = classify(model, img, tran, classes, device)
|
23 |
-
st.write(label)
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
tran = checkpoint['transform']
|
14 |
|
15 |
# upload image
|
16 |
+
while True:
|
17 |
+
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
|
18 |
+
taking_picture = st.camera_input("Take a picture...")
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
if uploaded_file is not None:
|
21 |
+
img = Image.open(uploaded_file)
|
22 |
+
st.image(img, caption='Uploaded Image.', use_column_width=True)
|
23 |
+
label = classify(model, img, tran, classes, device)
|
24 |
+
st.write(label)
|
25 |
+
|
26 |
+
elif taking_picture is not None:
|
27 |
+
img = Image.open(taking_picture)
|
28 |
+
st.image(img, caption='Uploaded Image.', use_column_width=True)
|
29 |
+
label = classify(model, img, tran, classes, device)
|
30 |
+
st.write(label)
|
31 |
+
|
32 |
+
else:
|
33 |
+
pass
|