Spaces:
Runtime error
Runtime error
allow uploading a batch of images
Browse files- kornia_aug.py +3 -4
kornia_aug.py
CHANGED
@@ -28,17 +28,16 @@ uploaded_files = st.sidebar.file_uploader("Choose a file",accept_multiple_files=
|
|
28 |
if uploaded_files is not None:
|
29 |
for uploaded_file in uploaded_files:
|
30 |
im = Image.open(uploaded_file)
|
|
|
31 |
im=im.resize((512,512))
|
32 |
image = F.pil_to_tensor(im).float() / 255
|
33 |
ims.append(image)
|
34 |
else:
|
35 |
im = Image.open("./images/pretty_bird.jpg")
|
|
|
36 |
image = F.pil_to_tensor(im).float() / 255
|
37 |
ims.append(image)
|
38 |
scaler = 256
|
39 |
-
st.sidebar.image(im, caption="Input Image", width=256)
|
40 |
-
|
41 |
-
|
42 |
|
43 |
# batch size is just for show
|
44 |
batch_size = st.sidebar.slider("batch_size", min_value=4, max_value=16,value=8)
|
@@ -72,7 +71,7 @@ nn.Sequential(
|
|
72 |
""",
|
73 |
"""
|
74 |
nn.Sequential(
|
75 |
-
kornia.augmentation.RandomErasing(scale=(.4, .8), ratio=(.3, 1/.3), p=1, same_on_batch=
|
76 |
)
|
77 |
#By setting same_on_batch=True you can apply the same transform across the batch
|
78 |
""",
|
|
|
28 |
if uploaded_files is not None:
|
29 |
for uploaded_file in uploaded_files:
|
30 |
im = Image.open(uploaded_file)
|
31 |
+
st.sidebar.image(im, caption="Input Image", width=256)
|
32 |
im=im.resize((512,512))
|
33 |
image = F.pil_to_tensor(im).float() / 255
|
34 |
ims.append(image)
|
35 |
else:
|
36 |
im = Image.open("./images/pretty_bird.jpg")
|
37 |
+
st.sidebar.image(im, caption="Input Image", width=256)
|
38 |
image = F.pil_to_tensor(im).float() / 255
|
39 |
ims.append(image)
|
40 |
scaler = 256
|
|
|
|
|
|
|
41 |
|
42 |
# batch size is just for show
|
43 |
batch_size = st.sidebar.slider("batch_size", min_value=4, max_value=16,value=8)
|
|
|
71 |
""",
|
72 |
"""
|
73 |
nn.Sequential(
|
74 |
+
kornia.augmentation.RandomErasing(scale=(.4, .8), ratio=(.3, 1/.3), p=1, same_on_batch=False),
|
75 |
)
|
76 |
#By setting same_on_batch=True you can apply the same transform across the batch
|
77 |
""",
|