phyloforfun commited on
Commit
a55a649
1 Parent(s): e2ca725
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -377,7 +377,7 @@ def refresh():
377
 
378
 
379
  def upload_local_prompt_to_server(dir_prompt):
380
- uploaded_file = st.file_uploader("Upload a custom prompt file", type=['yaml'])
381
  if uploaded_file is not None:
382
  # Check the file extension
383
  file_name = uploaded_file.name
@@ -390,6 +390,8 @@ def upload_local_prompt_to_server(dir_prompt):
390
  st.success(f"Saved file {file_name} in {dir_prompt}")
391
  else:
392
  st.error("Please upload a .yaml file that you previously created using this Prompt Builder tool.")
 
 
393
 
394
 
395
 
@@ -804,7 +806,7 @@ The desired null value is also given. Populate the field with the null value of
804
  st.session_state['selected_column'] = column_name
805
 
806
  # Form for input fields
807
- with st.form(key='rule_form'):
808
  format_options = ["verbatim transcription", "spell check transcription", "boolean yes no", "boolean 1 0", "integer", "[list]", "yyyy-mm-dd"]
809
  current_rule["format"] = st.selectbox("Format:", format_options, index=format_options.index(current_rule["format"]) if current_rule["format"] else 0)
810
  current_rule["null_value"] = st.text_input("Null value:", value=current_rule["null_value"])
@@ -1135,7 +1137,7 @@ def content_tab_settings():
1135
  n_images = len([f for f in os.listdir(st.session_state.config['leafmachine']['project']['dir_images_local']) if os.path.isfile(os.path.join(st.session_state.config['leafmachine']['project']['dir_images_local'], f))])
1136
  st.session_state['processing_add_on'] = f" {n_images} Images"
1137
  uploaded_files = None
1138
- st.info(f"Processing *{n_images}* images from {st.session_state.config['leafmachine']['project']['dir_images_local']}")
1139
 
1140
  st.button("Use Test Image",help="This will clear any uploaded images and load the 1 provided test image.",on_click=use_test_image)
1141
 
@@ -1256,6 +1258,9 @@ if 'user_clicked_load_prompt_yaml' not in st.session_state:
1256
  if 'processing_add_on' not in st.session_state:
1257
  st.session_state['processing_add_on'] = ' 1 Image'
1258
 
 
 
 
1259
  if 'LLM_VERSIONS' not in st.session_state:
1260
  st.session_state['LLM_VERSIONS'] = {
1261
  'OpenAI API': ["GPT 4", "GPT 3.5"],
 
377
 
378
 
379
  def upload_local_prompt_to_server(dir_prompt):
380
+ uploaded_file = st.file_uploader("Upload a custom prompt file", type=['yaml'], key=f"uploader{st.session_state['uploader_idk']}")
381
  if uploaded_file is not None:
382
  # Check the file extension
383
  file_name = uploaded_file.name
 
390
  st.success(f"Saved file {file_name} in {dir_prompt}")
391
  else:
392
  st.error("Please upload a .yaml file that you previously created using this Prompt Builder tool.")
393
+ st.session_state['uploader_idk'] += 1
394
+ st.rerun()
395
 
396
 
397
 
 
806
  st.session_state['selected_column'] = column_name
807
 
808
  # Form for input fields
809
+ with st.form(key='rule_form', clear_on_submit=True):
810
  format_options = ["verbatim transcription", "spell check transcription", "boolean yes no", "boolean 1 0", "integer", "[list]", "yyyy-mm-dd"]
811
  current_rule["format"] = st.selectbox("Format:", format_options, index=format_options.index(current_rule["format"]) if current_rule["format"] else 0)
812
  current_rule["null_value"] = st.text_input("Null value:", value=current_rule["null_value"])
 
1137
  n_images = len([f for f in os.listdir(st.session_state.config['leafmachine']['project']['dir_images_local']) if os.path.isfile(os.path.join(st.session_state.config['leafmachine']['project']['dir_images_local'], f))])
1138
  st.session_state['processing_add_on'] = f" {n_images} Images"
1139
  uploaded_files = None
1140
+ st.info(f"Processing **{n_images}** images from {st.session_state.config['leafmachine']['project']['dir_images_local']}")
1141
 
1142
  st.button("Use Test Image",help="This will clear any uploaded images and load the 1 provided test image.",on_click=use_test_image)
1143
 
 
1258
  if 'processing_add_on' not in st.session_state:
1259
  st.session_state['processing_add_on'] = ' 1 Image'
1260
 
1261
+ if 'uploader_idk' not in st.session_state:
1262
+ st.session_state['uploader_idk'] = 1
1263
+
1264
  if 'LLM_VERSIONS' not in st.session_state:
1265
  st.session_state['LLM_VERSIONS'] = {
1266
  'OpenAI API': ["GPT 4", "GPT 3.5"],