phyloforfun commited on
Commit
8d4eec7
1 Parent(s): 5efd4b8

file upload gallery

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -1043,11 +1043,13 @@ def content_header():
1043
 
1044
  def content_tab_settings():
1045
  st.header('Project')
1046
- col_project_1, col_project_2 = st.columns([4,2])
1047
 
1048
  st.write("---")
1049
  st.header('Input Images')
1050
- col_local_1, col_local_2, col_local_3 = st.columns([4,2,4])
 
 
1051
 
1052
  # st.write("---")
1053
  # st.header('Modules')
@@ -1061,22 +1063,18 @@ def content_tab_settings():
1061
  ### Project
1062
  with col_project_1:
1063
  st.session_state.config['leafmachine']['project']['run_name'] = st.text_input("Run name", st.session_state.config['leafmachine']['project'].get('run_name', ''))
1064
- st.session_state.config['leafmachine']['project']['dir_output'] = st.text_input("Output directory", st.session_state.config['leafmachine']['project'].get('dir_output', ''))
1065
 
1066
- ### Input Images Local
1067
- with col_local_1:
1068
  st.session_state.config['leafmachine']['project']['dir_images_local'] = st.session_state['dir_uploaded_images'] #st.text_input("Input images directory", st.session_state.config['leafmachine']['project'].get('dir_images_local', ''))
1069
- st.session_state.config['leafmachine']['project']['continue_run_from_partial_xlsx'] = st.text_input("Continue run from partially completed project XLSX", st.session_state.config['leafmachine']['project'].get('continue_run_from_partial_xlsx', ''), disabled=True)
1070
- st.write("---")
1071
  st.subheader('LLM Version')
1072
- st.markdown(
1073
- """
1074
- ***Note:*** GPT-4 is 20x more expensive than GPT-3.5
1075
- """
1076
- )
1077
  st.session_state.config['leafmachine']['LLM_version'] = st.selectbox("LLM version", ["GPT 4", "GPT 3.5", "Azure GPT 4", "Azure GPT 3.5", "PaLM 2"], index=["GPT 4", "GPT 3.5", "Azure GPT 4", "Azure GPT 3.5", "PaLM 2"].index(st.session_state.config['leafmachine'].get('LLM_version', 'Azure GPT 4')))
1078
-
1079
- st.write("---")
 
1080
  st.subheader('Prompt Version')
1081
  versions, default_version = get_prompt_versions(st.session_state.config['leafmachine']['LLM_version'])
1082
 
@@ -1086,7 +1084,8 @@ def content_tab_settings():
1086
  selected_version = default_version
1087
  st.session_state.config['leafmachine']['project']['prompt_version'] = st.selectbox("Prompt Version", versions, index=versions.index(selected_version))
1088
 
1089
- with col_local_2:
 
1090
  st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
1091
  uploaded_files = st.file_uploader("Upload Images", type=['jpg', 'jpeg'], accept_multiple_files=True)
1092
  if uploaded_files:
@@ -1102,7 +1101,8 @@ def content_tab_settings():
1102
  st.session_state['input_list'].appened(os.path.join(st.session_state.dir_home,'uploads',uploaded_file))
1103
  save_uploaded_file(st.session_state['dir_uploaded_images'], uploaded_file)
1104
 
1105
- with col_local_3:
 
1106
  selected_img = image_select("Uploaded Images Ready for Transcription", st.session_state['input_list'], use_container_width=False)
1107
  st.button("Clear Staged Images",on_click=delete_directory, args=[st.session_state['dir_uploaded_images']])
1108
 
@@ -1391,6 +1391,8 @@ if 'rules' not in st.session_state:
1391
  st.session_state['rules'] = {}
1392
  if 'zip_filepath' not in st.session_state:
1393
  st.session_state['zip_filepath'] = None
 
 
1394
 
1395
 
1396
  # if not st.session_state.private_file:
 
1043
 
1044
  def content_tab_settings():
1045
  st.header('Project')
1046
+ col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
1047
 
1048
  st.write("---")
1049
  st.header('Input Images')
1050
+ st.write('Upload a batch of images using the uploader below. These images will be store temporarily on this server. Each time you upload new images the ***previously uploaded images will be deleted***. You can also clear these cached images by pressing the "Clear Staged Images" button.')
1051
+
1052
+ col_local_1, col_local_2 = st.columns([2,6])
1053
 
1054
  # st.write("---")
1055
  # st.header('Modules')
 
1063
  ### Project
1064
  with col_project_1:
1065
  st.session_state.config['leafmachine']['project']['run_name'] = st.text_input("Run name", st.session_state.config['leafmachine']['project'].get('run_name', ''))
1066
+ # st.session_state.config['leafmachine']['project']['dir_output'] = st.text_input("Output directory", st.session_state.config['leafmachine']['project'].get('dir_output', ''))
1067
 
1068
+ ### LLM Version
1069
+ with col_project_2:
1070
  st.session_state.config['leafmachine']['project']['dir_images_local'] = st.session_state['dir_uploaded_images'] #st.text_input("Input images directory", st.session_state.config['leafmachine']['project'].get('dir_images_local', ''))
1071
+ # st.session_state.config['leafmachine']['project']['continue_run_from_partial_xlsx'] = st.text_input("Continue run from partially completed project XLSX", st.session_state.config['leafmachine']['project'].get('continue_run_from_partial_xlsx', ''), disabled=True)
 
1072
  st.subheader('LLM Version')
1073
+ st.markdown("""***Note:*** GPT-4 is significantly more expensive than GPT-3.5 """)
 
 
 
 
1074
  st.session_state.config['leafmachine']['LLM_version'] = st.selectbox("LLM version", ["GPT 4", "GPT 3.5", "Azure GPT 4", "Azure GPT 3.5", "PaLM 2"], index=["GPT 4", "GPT 3.5", "Azure GPT 4", "Azure GPT 3.5", "PaLM 2"].index(st.session_state.config['leafmachine'].get('LLM_version', 'Azure GPT 4')))
1075
+
1076
+ ### Prompt Version
1077
+ with col_project_3:
1078
  st.subheader('Prompt Version')
1079
  versions, default_version = get_prompt_versions(st.session_state.config['leafmachine']['LLM_version'])
1080
 
 
1084
  selected_version = default_version
1085
  st.session_state.config['leafmachine']['project']['prompt_version'] = st.selectbox("Prompt Version", versions, index=versions.index(selected_version))
1086
 
1087
+ ### Input Images Local
1088
+ with col_local_1:
1089
  st.session_state['dir_uploaded_images'] = os.path.join(st.session_state.dir_home,'uploads')
1090
  uploaded_files = st.file_uploader("Upload Images", type=['jpg', 'jpeg'], accept_multiple_files=True)
1091
  if uploaded_files:
 
1101
  st.session_state['input_list'].appened(os.path.join(st.session_state.dir_home,'uploads',uploaded_file))
1102
  save_uploaded_file(st.session_state['dir_uploaded_images'], uploaded_file)
1103
 
1104
+ with col_local_2:
1105
+ st.subheader('Image Gallery')
1106
  selected_img = image_select("Uploaded Images Ready for Transcription", st.session_state['input_list'], use_container_width=False)
1107
  st.button("Clear Staged Images",on_click=delete_directory, args=[st.session_state['dir_uploaded_images']])
1108
 
 
1391
  st.session_state['rules'] = {}
1392
  if 'zip_filepath' not in st.session_state:
1393
  st.session_state['zip_filepath'] = None
1394
+ if 'input_list' not in st.session_state:
1395
+ st.session_state['input_list'] = []
1396
 
1397
 
1398
  # if not st.session_state.private_file: