phyloforfun commited on
Commit
cc9202c
1 Parent(s): 08a14c4

file upload gallery

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -815,6 +815,10 @@ The desired null value is also given. Populate the field with the null value of
815
  st.title("Custom LLM Prompt Builder")
816
  st.subheader('About')
817
  st.write("This form allows you to craft a prompt for your specific task.")
 
 
 
 
818
  st.subheader('How it works')
819
  st.write("1. Edit this page until you are happy with your instructions. We recommend looking at the basic structure, writing down your prompt inforamtion in a Word document so that it does not randomly disappear, and then copying and pasting that info into this form once your whole prompt structure is defined.")
820
  st.write("2. After you enter all of your prompt instructions, click 'Save' and give your file a name.")
@@ -830,23 +834,22 @@ The desired null value is also given. Populate the field with the null value of
830
  # Upload a prompt from your computer
831
  upload_local_prompt_to_server(dir_prompt)
832
 
833
-
834
  with col_upload_btn:
835
  st.write('##')
836
  # Button to load the selected prompt
837
- st.button('Load Prompt', on_click=btn_load_prompt, args=[selected_yaml_file, dir_prompt])
838
 
839
  col_select_yaml, col_download_btn = st.columns([8,2])
840
  with col_select_yaml:
841
  # Dropdown for selecting a YAML file
842
- selected_yaml_file = st.selectbox('Select a prompt .YAML file to load:', [''] + yaml_files)
843
 
844
  with col_download_btn:
845
- if selected_yaml_file:
846
  # Construct the full path to the file
847
- download_file_path = os.path.join(dir_prompt, selected_yaml_file)
848
  # Create the download button
849
- create_download_button(download_file_path, selected_yaml_file)
850
 
851
 
852
  # Define the options for the dropdown
@@ -1567,6 +1570,8 @@ if 'input_list' not in st.session_state:
1567
  st.session_state['input_list'] = []
1568
  if 'input_list_small' not in st.session_state:
1569
  st.session_state['input_list_small'] = []
 
 
1570
 
1571
 
1572
  # if not st.session_state.private_file:
 
815
  st.title("Custom LLM Prompt Builder")
816
  st.subheader('About')
817
  st.write("This form allows you to craft a prompt for your specific task.")
818
+ st.subheader('For Hugging Face Spaces')
819
+ st.write("If you create a prompt with the Hugging Face Spaces implementation of VoucherVision, make sure that you download the prompt immediately after you have 'Saved' the prompt. Default storage space on HF Spaces is not persistant, so if you refresh the page your prompt will probably disappear.")
820
+ st.write("You can submit your prompt using this link and we will add it to our library so it will always be available.")
821
+
822
  st.subheader('How it works')
823
  st.write("1. Edit this page until you are happy with your instructions. We recommend looking at the basic structure, writing down your prompt inforamtion in a Word document so that it does not randomly disappear, and then copying and pasting that info into this form once your whole prompt structure is defined.")
824
  st.write("2. After you enter all of your prompt instructions, click 'Save' and give your file a name.")
 
834
  # Upload a prompt from your computer
835
  upload_local_prompt_to_server(dir_prompt)
836
 
 
837
  with col_upload_btn:
838
  st.write('##')
839
  # Button to load the selected prompt
840
+ st.button('Load Prompt into Builder', on_click=btn_load_prompt, args=[st.session_state['selected_yaml_file'] , dir_prompt])
841
 
842
  col_select_yaml, col_download_btn = st.columns([8,2])
843
  with col_select_yaml:
844
  # Dropdown for selecting a YAML file
845
+ st.session_state['selected_yaml_file'] = st.selectbox('Select a prompt .YAML file to load:', [''] + yaml_files)
846
 
847
  with col_download_btn:
848
+ if st.session_state['selected_yaml_file']:
849
  # Construct the full path to the file
850
+ download_file_path = os.path.join(dir_prompt, st.session_state['selected_yaml_file'] )
851
  # Create the download button
852
+ create_download_button(download_file_path, st.session_state['selected_yaml_file'] )
853
 
854
 
855
  # Define the options for the dropdown
 
1570
  st.session_state['input_list'] = []
1571
  if 'input_list_small' not in st.session_state:
1572
  st.session_state['input_list_small'] = []
1573
+ if 'selected_yaml_file' not in st.session_state:
1574
+ st.session_state['selected_yaml_file'] = None
1575
 
1576
 
1577
  # if not st.session_state.private_file: