Spaces:
Running
Running
Commit
·
72a3893
1
Parent(s):
5091b7c
updates
Browse files
app.py
CHANGED
|
@@ -255,7 +255,7 @@ def load_gallery(converted_files, uploaded_file):
|
|
| 255 |
|
| 256 |
@st.cache_data
|
| 257 |
def handle_image_upload_and_gallery_hf(uploaded_files):
|
| 258 |
-
SAFE = SafetyCheck(st.session_state['is_hf'])
|
| 259 |
if uploaded_files:
|
| 260 |
|
| 261 |
# Clear input image gallery and input list
|
|
@@ -264,11 +264,11 @@ def handle_image_upload_and_gallery_hf(uploaded_files):
|
|
| 264 |
ind_small = 0
|
| 265 |
for uploaded_file in uploaded_files:
|
| 266 |
|
| 267 |
-
if SAFE.check_for_inappropriate_content(uploaded_file):
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
|
| 273 |
|
| 274 |
# Determine the file type
|
|
@@ -319,7 +319,7 @@ def handle_image_upload_and_gallery_hf(uploaded_files):
|
|
| 319 |
images_to_display = st.session_state['input_list_small']
|
| 320 |
show_gallery_small_hf(images_to_display)
|
| 321 |
|
| 322 |
-
return False
|
| 323 |
|
| 324 |
|
| 325 |
@st.cache_data
|
|
@@ -371,6 +371,8 @@ def handle_image_upload_and_gallery():
|
|
| 371 |
|
| 372 |
|
| 373 |
def content_input_images(col_left, col_right):
|
|
|
|
|
|
|
| 374 |
st.write('---')
|
| 375 |
# col1, col2 = st.columns([2,8])
|
| 376 |
with col_left:
|
|
@@ -393,7 +395,16 @@ def content_input_images(col_left, col_right):
|
|
| 393 |
|
| 394 |
with col_right:
|
| 395 |
if st.session_state.is_hf:
|
| 396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
|
| 398 |
else:
|
| 399 |
st.session_state['view_local_gallery'] = st.toggle("View Image Gallery",)
|
|
|
|
| 255 |
|
| 256 |
@st.cache_data
|
| 257 |
def handle_image_upload_and_gallery_hf(uploaded_files):
|
| 258 |
+
# SAFE = SafetyCheck(st.session_state['is_hf'])
|
| 259 |
if uploaded_files:
|
| 260 |
|
| 261 |
# Clear input image gallery and input list
|
|
|
|
| 264 |
ind_small = 0
|
| 265 |
for uploaded_file in uploaded_files:
|
| 266 |
|
| 267 |
+
# if SAFE.check_for_inappropriate_content(uploaded_file):
|
| 268 |
+
# clear_image_uploads()
|
| 269 |
+
# report_violation(uploaded_file.name, is_hf=st.session_state['is_hf'])
|
| 270 |
+
# st.error("Warning: You uploaded an image that violates our terms of service.")
|
| 271 |
+
# return True
|
| 272 |
|
| 273 |
|
| 274 |
# Determine the file type
|
|
|
|
| 319 |
images_to_display = st.session_state['input_list_small']
|
| 320 |
show_gallery_small_hf(images_to_display)
|
| 321 |
|
| 322 |
+
# return False
|
| 323 |
|
| 324 |
|
| 325 |
@st.cache_data
|
|
|
|
| 371 |
|
| 372 |
|
| 373 |
def content_input_images(col_left, col_right):
|
| 374 |
+
SAFE = SafetyCheck(st.session_state['is_hf'])
|
| 375 |
+
|
| 376 |
st.write('---')
|
| 377 |
# col1, col2 = st.columns([2,8])
|
| 378 |
with col_left:
|
|
|
|
| 395 |
|
| 396 |
with col_right:
|
| 397 |
if st.session_state.is_hf:
|
| 398 |
+
if uploaded_files:
|
| 399 |
+
is_violation = False
|
| 400 |
+
for uploaded_file in uploaded_files:
|
| 401 |
+
if SAFE.check_for_inappropriate_content(uploaded_file):
|
| 402 |
+
clear_image_uploads()
|
| 403 |
+
report_violation(uploaded_file.name, is_hf=st.session_state['is_hf'])
|
| 404 |
+
st.error("Warning: You uploaded an image that violates our terms of service.")
|
| 405 |
+
is_violation = True
|
| 406 |
+
if not is_violation:
|
| 407 |
+
handle_image_upload_and_gallery_hf(uploaded_files)
|
| 408 |
|
| 409 |
else:
|
| 410 |
st.session_state['view_local_gallery'] = st.toggle("View Image Gallery",)
|