Spaces:
Running
Running
Commit
·
446471a
1
Parent(s):
74ef197
update
Browse files
app.py
CHANGED
|
@@ -804,7 +804,7 @@ def create_download_button(zip_filepath):
|
|
| 804 |
with open(zip_filepath, 'rb') as f:
|
| 805 |
bytes_io = BytesIO(f.read())
|
| 806 |
st.download_button(
|
| 807 |
-
label=f"Download Results for{st.session_state['processing_add_on']}",
|
| 808 |
data=bytes_io,
|
| 809 |
file_name=os.path.basename(zip_filepath),
|
| 810 |
mime='application/zip'
|
|
@@ -839,7 +839,7 @@ def btn_load_prompt(selected_yaml_file, dir_prompt):
|
|
| 839 |
}
|
| 840 |
|
| 841 |
def refresh():
|
| 842 |
-
st.
|
| 843 |
|
| 844 |
def upload_local_prompt_to_server(dir_prompt):
|
| 845 |
uploaded_file = st.file_uploader("Upload a custom prompt file", type=['yaml'])
|
|
@@ -1260,7 +1260,7 @@ def content_header():
|
|
| 1260 |
st.session_state['processing_add_on'] = f" {determine_n_images()} Images"
|
| 1261 |
else:
|
| 1262 |
st.session_state['processing_add_on'] = ''
|
| 1263 |
-
|
| 1264 |
|
| 1265 |
if check_if_usable():
|
| 1266 |
if st.button(f"Start Processing{st.session_state['processing_add_on']}", type='primary'):
|
|
@@ -1347,6 +1347,12 @@ def content_header():
|
|
| 1347 |
# for message in info:
|
| 1348 |
# st.error(message)
|
| 1349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1350 |
def content_tab_settings():
|
| 1351 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|
| 1352 |
|
|
@@ -1416,10 +1422,8 @@ def content_tab_settings():
|
|
| 1416 |
uploaded_files = st.file_uploader("Upload Images", type=['jpg', 'jpeg'], accept_multiple_files=True)
|
| 1417 |
if uploaded_files:
|
| 1418 |
# Clear input image gallery and input list
|
| 1419 |
-
|
| 1420 |
-
|
| 1421 |
-
validate_dir(st.session_state['dir_uploaded_images'])
|
| 1422 |
-
validate_dir(st.session_state['dir_uploaded_images_small'])
|
| 1423 |
# Process the new iamges
|
| 1424 |
for uploaded_file in uploaded_files:
|
| 1425 |
file_path = save_uploaded_file(st.session_state['dir_uploaded_images'], uploaded_file)
|
|
@@ -1737,10 +1741,10 @@ if 'proceed_to_private' not in st.session_state:
|
|
| 1737 |
if 'dir_uploaded_images' not in st.session_state:
|
| 1738 |
st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
|
| 1739 |
validate_dir(os.path.join(st.session_state.dir_home,'uploads'))
|
| 1740 |
-
|
| 1741 |
-
|
| 1742 |
-
|
| 1743 |
-
|
| 1744 |
|
| 1745 |
# Initialize session_state variables if they don't exist
|
| 1746 |
if 'prompt_info' not in st.session_state:
|
|
|
|
| 804 |
with open(zip_filepath, 'rb') as f:
|
| 805 |
bytes_io = BytesIO(f.read())
|
| 806 |
st.download_button(
|
| 807 |
+
label=f"Download Results for{st.session_state['processing_add_on']}",type='primary',
|
| 808 |
data=bytes_io,
|
| 809 |
file_name=os.path.basename(zip_filepath),
|
| 810 |
mime='application/zip'
|
|
|
|
| 839 |
}
|
| 840 |
|
| 841 |
def refresh():
|
| 842 |
+
st.rerun()
|
| 843 |
|
| 844 |
def upload_local_prompt_to_server(dir_prompt):
|
| 845 |
uploaded_file = st.file_uploader("Upload a custom prompt file", type=['yaml'])
|
|
|
|
| 1260 |
st.session_state['processing_add_on'] = f" {determine_n_images()} Images"
|
| 1261 |
else:
|
| 1262 |
st.session_state['processing_add_on'] = ''
|
| 1263 |
+
print(f"HERE --- {st.session_state['processing_add_on']}")
|
| 1264 |
|
| 1265 |
if check_if_usable():
|
| 1266 |
if st.button(f"Start Processing{st.session_state['processing_add_on']}", type='primary'):
|
|
|
|
| 1347 |
# for message in info:
|
| 1348 |
# st.error(message)
|
| 1349 |
|
| 1350 |
+
def clear_image_gallery():
|
| 1351 |
+
delete_directory(st.session_state['dir_uploaded_images'])
|
| 1352 |
+
delete_directory(st.session_state['dir_uploaded_images_small'])
|
| 1353 |
+
validate_dir(st.session_state['dir_uploaded_images'])
|
| 1354 |
+
validate_dir(st.session_state['dir_uploaded_images_small'])
|
| 1355 |
+
|
| 1356 |
def content_tab_settings():
|
| 1357 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|
| 1358 |
|
|
|
|
| 1422 |
uploaded_files = st.file_uploader("Upload Images", type=['jpg', 'jpeg'], accept_multiple_files=True)
|
| 1423 |
if uploaded_files:
|
| 1424 |
# Clear input image gallery and input list
|
| 1425 |
+
clear_image_gallery()
|
| 1426 |
+
|
|
|
|
|
|
|
| 1427 |
# Process the new iamges
|
| 1428 |
for uploaded_file in uploaded_files:
|
| 1429 |
file_path = save_uploaded_file(st.session_state['dir_uploaded_images'], uploaded_file)
|
|
|
|
| 1741 |
if 'dir_uploaded_images' not in st.session_state:
|
| 1742 |
st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
|
| 1743 |
validate_dir(os.path.join(st.session_state.dir_home,'uploads'))
|
| 1744 |
+
if 'dir_uploaded_images_small' not in st.session_state:
|
| 1745 |
+
st.session_state['dir_uploaded_images_small'] = os.path.join(st.session_state.dir_home,'uploads_small')
|
| 1746 |
+
validate_dir(os.path.join(st.session_state.dir_home,'uploads_small'))
|
| 1747 |
+
|
| 1748 |
|
| 1749 |
# Initialize session_state variables if they don't exist
|
| 1750 |
if 'prompt_info' not in st.session_state:
|