Spaces:
Running
Running
phyloforfun
commited on
Commit
•
eb18fda
1
Parent(s):
d88f98b
file upload gallery
Browse files
app.py
CHANGED
@@ -1218,6 +1218,17 @@ def show_header_welcome():
|
|
1218 |
st.session_state.logo = Image.open(st.session_state.logo_path)
|
1219 |
st.image(st.session_state.logo, width=250)
|
1220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1221 |
def content_header():
|
1222 |
col_run_1, col_run_2, col_run_3, col_run_4 = st.columns([2,2,2,2])
|
1223 |
|
@@ -1244,8 +1255,15 @@ def content_header():
|
|
1244 |
show_header_welcome()
|
1245 |
st.subheader('Run VoucherVision')
|
1246 |
N_STEPS = 6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1247 |
if check_if_usable():
|
1248 |
-
if st.button("Start Processing", type='primary'):
|
1249 |
|
1250 |
# First, write the config file.
|
1251 |
write_config_file(st.session_state.config, st.session_state.dir_home, filename="VoucherVision.yaml")
|
@@ -1399,8 +1417,9 @@ def content_tab_settings():
|
|
1399 |
if uploaded_files:
|
1400 |
# Clear input image gallery and input list
|
1401 |
delete_directory(st.session_state['dir_uploaded_images'])
|
1402 |
-
st.session_state['
|
1403 |
validate_dir(st.session_state['dir_uploaded_images'])
|
|
|
1404 |
# Process the new iamges
|
1405 |
for uploaded_file in uploaded_files:
|
1406 |
file_path = save_uploaded_file(st.session_state['dir_uploaded_images'], uploaded_file)
|
@@ -1744,6 +1763,8 @@ if 'show_prompt_name_w' not in st.session_state:
|
|
1744 |
st.session_state['show_prompt_name_w'] = None
|
1745 |
if 'user_clicked_load_prompt_yaml' not in st.session_state:
|
1746 |
st.session_state['user_clicked_load_prompt_yaml'] = None
|
|
|
|
|
1747 |
|
1748 |
if 'LLM_VERSIONS' not in st.session_state:
|
1749 |
st.session_state['LLM_VERSIONS'] = {
|
|
|
1218 |
st.session_state.logo = Image.open(st.session_state.logo_path)
|
1219 |
st.image(st.session_state.logo, width=250)
|
1220 |
|
1221 |
+
def determine_n_images():
|
1222 |
+
try:
|
1223 |
+
# Check if 'dir_uploaded_images' key exists and it is not empty
|
1224 |
+
if 'dir_uploaded_images' in st and st['dir_uploaded_images']:
|
1225 |
+
dir_path = st['dir_uploaded_images'] # This would be the path to the directory
|
1226 |
+
return len([f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f))])
|
1227 |
+
else:
|
1228 |
+
return None
|
1229 |
+
except:
|
1230 |
+
return None
|
1231 |
+
|
1232 |
def content_header():
|
1233 |
col_run_1, col_run_2, col_run_3, col_run_4 = st.columns([2,2,2,2])
|
1234 |
|
|
|
1255 |
show_header_welcome()
|
1256 |
st.subheader('Run VoucherVision')
|
1257 |
N_STEPS = 6
|
1258 |
+
|
1259 |
+
if determine_n_images():
|
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'):
|
1267 |
|
1268 |
# First, write the config file.
|
1269 |
write_config_file(st.session_state.config, st.session_state.dir_home, filename="VoucherVision.yaml")
|
|
|
1417 |
if uploaded_files:
|
1418 |
# Clear input image gallery and input list
|
1419 |
delete_directory(st.session_state['dir_uploaded_images'])
|
1420 |
+
delete_directory(st.session_state['dir_uploaded_images_small'])
|
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)
|
|
|
1763 |
st.session_state['show_prompt_name_w'] = None
|
1764 |
if 'user_clicked_load_prompt_yaml' not in st.session_state:
|
1765 |
st.session_state['user_clicked_load_prompt_yaml'] = None
|
1766 |
+
if 'processing_add_on' not in st.session_state:
|
1767 |
+
st.session_state['processing_add_on'] = ''
|
1768 |
|
1769 |
if 'LLM_VERSIONS' not in st.session_state:
|
1770 |
st.session_state['LLM_VERSIONS'] = {
|