Spaces:
Running
Running
phyloforfun
commited on
Commit
•
d2fb9ea
1
Parent(s):
6275f78
file upload gallery
Browse files
app.py
CHANGED
@@ -679,6 +679,7 @@ def save_changes_to_API_keys(cfg_private,openai_api_key,azure_openai_api_version
|
|
679 |
|
680 |
# Function to load a YAML file and update session_state
|
681 |
def load_prompt_yaml(filename):
|
|
|
682 |
with open(filename, 'r') as file:
|
683 |
st.session_state['prompt_info'] = yaml.safe_load(file)
|
684 |
st.session_state['prompt_author'] = st.session_state['prompt_info'].get('prompt_author', st.session_state['default_prompt_author'])
|
@@ -1161,12 +1162,18 @@ The desired null value is also given. Populate the field with the null value of
|
|
1161 |
st.rerun()
|
1162 |
|
1163 |
with col_prompt_main_right:
|
1164 |
-
if st.session_state['
|
1165 |
-
st.session_state['show_prompt_name_e'] = f"
|
1166 |
-
|
|
|
|
|
|
|
1167 |
else:
|
1168 |
-
st.session_state['show_prompt_name_e'] = f"
|
1169 |
-
st.session_state['
|
|
|
|
|
|
|
1170 |
|
1171 |
st.subheader(f'Full Prompt')
|
1172 |
st.write(st.session_state['show_prompt_name_e'])
|
@@ -1682,6 +1689,8 @@ if 'show_prompt_name_e' not in st.session_state:
|
|
1682 |
st.session_state['show_prompt_name_e'] = None
|
1683 |
if 'show_prompt_name_w' not in st.session_state:
|
1684 |
st.session_state['show_prompt_name_w'] = None
|
|
|
|
|
1685 |
|
1686 |
|
1687 |
# if not st.session_state.private_file:
|
|
|
679 |
|
680 |
# Function to load a YAML file and update session_state
|
681 |
def load_prompt_yaml(filename):
|
682 |
+
st.session_state['user_clicked_load_prompt_yaml'] = filename
|
683 |
with open(filename, 'r') as file:
|
684 |
st.session_state['prompt_info'] = yaml.safe_load(file)
|
685 |
st.session_state['prompt_author'] = st.session_state['prompt_info'].get('prompt_author', st.session_state['default_prompt_author'])
|
|
|
1162 |
st.rerun()
|
1163 |
|
1164 |
with col_prompt_main_right:
|
1165 |
+
if st.session_state['user_clicked_load_prompt_yaml'] is None: # see if user has loaded a yaml to edit
|
1166 |
+
st.session_state['show_prompt_name_e'] = f"Prompt: building prompt from scratch"
|
1167 |
+
if st.session_state['new_prompt_yaml_filename']:
|
1168 |
+
st.session_state['show_prompt_name_w'] = f"Prompt Saved As: {st.session_state['new_prompt_yaml_filename']}.yaml"
|
1169 |
+
else:
|
1170 |
+
st.session_state['show_prompt_name_w'] = f"Prompt Saved As: PLEASE SET NAME"
|
1171 |
else:
|
1172 |
+
st.session_state['show_prompt_name_e'] = f"Prompt: editing --> {st.session_state['selected_yaml_file']}"
|
1173 |
+
if st.session_state['new_prompt_yaml_filename']:
|
1174 |
+
st.session_state['show_prompt_name_w'] = f"Prompt Saved As: {st.session_state['new_prompt_yaml_filename']}.yaml"
|
1175 |
+
else:
|
1176 |
+
st.session_state['show_prompt_name_w'] = f"Prompt Saved As: PLEASE SET NAME"
|
1177 |
|
1178 |
st.subheader(f'Full Prompt')
|
1179 |
st.write(st.session_state['show_prompt_name_e'])
|
|
|
1689 |
st.session_state['show_prompt_name_e'] = None
|
1690 |
if 'show_prompt_name_w' not in st.session_state:
|
1691 |
st.session_state['show_prompt_name_w'] = None
|
1692 |
+
if 'user_clicked_load_prompt_yaml' not in st.session_state:
|
1693 |
+
st.session_state['user_clicked_load_prompt_yaml'] = None
|
1694 |
|
1695 |
|
1696 |
# if not st.session_state.private_file:
|