Spaces:
Running
Running
Commit
·
98a227a
1
Parent(s):
ef4e9d6
fix safety check
Browse files- app.py +2 -2
- vouchervision/utils_hf.py +1 -1
app.py
CHANGED
|
@@ -216,10 +216,10 @@ if 'dir_images_local_TEMP' not in st.session_state:
|
|
| 216 |
st.session_state['dir_images_local_TEMP'] = False
|
| 217 |
if 'dir_uploaded_images' not in st.session_state:
|
| 218 |
st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
|
| 219 |
-
validate_dir(
|
| 220 |
if 'dir_uploaded_images_small' not in st.session_state:
|
| 221 |
st.session_state['dir_uploaded_images_small'] = os.path.join(st.session_state.dir_home,'uploads_small')
|
| 222 |
-
validate_dir(
|
| 223 |
|
| 224 |
|
| 225 |
|
|
|
|
| 216 |
st.session_state['dir_images_local_TEMP'] = False
|
| 217 |
if 'dir_uploaded_images' not in st.session_state:
|
| 218 |
st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
|
| 219 |
+
validate_dir(st.session_state['dir_uploaded_images'])
|
| 220 |
if 'dir_uploaded_images_small' not in st.session_state:
|
| 221 |
st.session_state['dir_uploaded_images_small'] = os.path.join(st.session_state.dir_home,'uploads_small')
|
| 222 |
+
validate_dir(st.session_state['dir_uploaded_images_small'])
|
| 223 |
|
| 224 |
|
| 225 |
|
vouchervision/utils_hf.py
CHANGED
|
@@ -105,7 +105,7 @@ def save_uploaded_file(directory, img_file, image=None):
|
|
| 105 |
# Return the full path of the saved image
|
| 106 |
return full_path
|
| 107 |
except:
|
| 108 |
-
with Image.open(
|
| 109 |
full_path = os.path.join(directory, img_file.name)
|
| 110 |
image.save(full_path, "JPEG")
|
| 111 |
# Return the full path of the saved image
|
|
|
|
| 105 |
# Return the full path of the saved image
|
| 106 |
return full_path
|
| 107 |
except:
|
| 108 |
+
with Image.open(img_file.name) as image:
|
| 109 |
full_path = os.path.join(directory, img_file.name)
|
| 110 |
image.save(full_path, "JPEG")
|
| 111 |
# Return the full path of the saved image
|