Spaces:
Running
Running
Commit
·
e86548c
1
Parent(s):
0bec306
file upload gallery
Browse files
app.py
CHANGED
|
@@ -551,6 +551,11 @@ def delete_directory(dir_path):
|
|
| 551 |
# except Exception as e:
|
| 552 |
# with message_loc:
|
| 553 |
# st.error(f"Google PaLM 2 API Key Failed:exclamation: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
def display_image_gallery():
|
| 555 |
"""
|
| 556 |
Display an image gallery from st.session_state['input_list'] in a scrollable container.
|
|
@@ -1082,7 +1087,6 @@ def content_header():
|
|
| 1082 |
st.error(message)
|
| 1083 |
|
| 1084 |
def content_tab_settings():
|
| 1085 |
-
st.header('Project')
|
| 1086 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|
| 1087 |
|
| 1088 |
st.write("---")
|
|
@@ -1102,16 +1106,18 @@ def content_tab_settings():
|
|
| 1102 |
os.path.join(st.session_state.dir_home, )
|
| 1103 |
### Project
|
| 1104 |
with col_project_1:
|
| 1105 |
-
st.
|
|
|
|
| 1106 |
# st.session_state.config['leafmachine']['project']['dir_output'] = st.text_input("Output directory", st.session_state.config['leafmachine']['project'].get('dir_output', ''))
|
| 1107 |
-
|
|
|
|
| 1108 |
### LLM Version
|
| 1109 |
with col_project_2:
|
| 1110 |
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', ''))
|
| 1111 |
# 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)
|
| 1112 |
st.subheader('LLM Version')
|
| 1113 |
-
st.markdown("""***Note:*** GPT-4 is significantly more expensive than GPT-3.5 """)
|
| 1114 |
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')))
|
|
|
|
| 1115 |
|
| 1116 |
### Prompt Version
|
| 1117 |
with col_project_3:
|
|
@@ -1122,7 +1128,7 @@ def content_tab_settings():
|
|
| 1122 |
selected_version = st.session_state.config['leafmachine']['project'].get('prompt_version', default_version)
|
| 1123 |
if selected_version not in versions:
|
| 1124 |
selected_version = default_version
|
| 1125 |
-
st.session_state.config['leafmachine']['project']['prompt_version'] = st.selectbox("Prompt Version", versions, index=versions.index(selected_version))
|
| 1126 |
|
| 1127 |
### Input Images Local
|
| 1128 |
with col_local_1:
|
|
|
|
| 551 |
# except Exception as e:
|
| 552 |
# with message_loc:
|
| 553 |
# st.error(f"Google PaLM 2 API Key Failed:exclamation: {e}")
|
| 554 |
+
def image_to_base64(img):
|
| 555 |
+
buffered = BytesIO()
|
| 556 |
+
img.save(buffered, format="JPEG")
|
| 557 |
+
return base64.b64encode(buffered.getvalue()).decode()
|
| 558 |
+
|
| 559 |
def display_image_gallery():
|
| 560 |
"""
|
| 561 |
Display an image gallery from st.session_state['input_list'] in a scrollable container.
|
|
|
|
| 1087 |
st.error(message)
|
| 1088 |
|
| 1089 |
def content_tab_settings():
|
|
|
|
| 1090 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|
| 1091 |
|
| 1092 |
st.write("---")
|
|
|
|
| 1106 |
os.path.join(st.session_state.dir_home, )
|
| 1107 |
### Project
|
| 1108 |
with col_project_1:
|
| 1109 |
+
st.subheader('Run name')
|
| 1110 |
+
st.session_state.config['leafmachine']['project']['run_name'] = st.text_input("Run name", st.session_state.config['leafmachine']['project'].get('run_name', ''),label_visibility='collapsed')
|
| 1111 |
# st.session_state.config['leafmachine']['project']['dir_output'] = st.text_input("Output directory", st.session_state.config['leafmachine']['project'].get('dir_output', ''))
|
| 1112 |
+
st.write("Run name will be the name of the final zipped folder.")
|
| 1113 |
+
|
| 1114 |
### LLM Version
|
| 1115 |
with col_project_2:
|
| 1116 |
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', ''))
|
| 1117 |
# 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)
|
| 1118 |
st.subheader('LLM Version')
|
|
|
|
| 1119 |
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')))
|
| 1120 |
+
st.markdown("""***Note:*** GPT-4 is significantly more expensive than GPT-3.5 """)
|
| 1121 |
|
| 1122 |
### Prompt Version
|
| 1123 |
with col_project_3:
|
|
|
|
| 1128 |
selected_version = st.session_state.config['leafmachine']['project'].get('prompt_version', default_version)
|
| 1129 |
if selected_version not in versions:
|
| 1130 |
selected_version = default_version
|
| 1131 |
+
st.session_state.config['leafmachine']['project']['prompt_version'] = st.selectbox("Prompt Version", versions, index=versions.index(selected_version),label_visibility='collapsed')
|
| 1132 |
|
| 1133 |
### Input Images Local
|
| 1134 |
with col_local_1:
|