Spaces:
Running
Running
Commit
·
b3f995d
1
Parent(s):
9315cb7
Major update. Support for 15 LLMs, World Flora Online taxonomy validation, geolocation, 2 OCR methods, significant UI changes, stability improvements, consistent JSON parsing
Browse files- app.py +32 -25
- demo/ba/ba2.png +2 -2
- demo/ba/ba2_low.png +3 -0
- demo/ba/ocr2.png +3 -0
- demo/ba/ocr2_low.png +3 -0
app.py
CHANGED
|
@@ -1854,12 +1854,12 @@ def content_collage_overlay():
|
|
| 1854 |
# Load the image only if it's not already in the session state
|
| 1855 |
if "demo_collage" not in st.session_state:
|
| 1856 |
# ba = os.path.join(st.session_state.dir_home, 'demo', 'ba', 'ba2.png')
|
| 1857 |
-
ba = os.path.join(st.session_state.dir_home, 'demo', 'ba', 'ba2.
|
| 1858 |
st.session_state["demo_collage"] = Image.open(ba)
|
| 1859 |
|
| 1860 |
# Display the image
|
| 1861 |
-
|
| 1862 |
-
st.image(st.session_state["demo_collage"], caption='LeafMachine2 Collage', output_format="JPEG")
|
| 1863 |
|
| 1864 |
|
| 1865 |
|
|
@@ -1928,11 +1928,11 @@ def content_collage_overlay():
|
|
| 1928 |
with col_ocr_2:
|
| 1929 |
if "demo_overlay" not in st.session_state:
|
| 1930 |
# ocr = os.path.join(st.session_state.dir_home,'demo', 'ba','ocr.png')
|
| 1931 |
-
ocr = os.path.join(st.session_state.dir_home,'demo', 'ba','
|
| 1932 |
st.session_state["demo_overlay"] = Image.open(ocr)
|
| 1933 |
|
| 1934 |
-
|
| 1935 |
-
st.image(st.session_state["demo_overlay"], caption='OCR Overlay Images', output_format = "JPEG")
|
| 1936 |
|
| 1937 |
|
| 1938 |
|
|
@@ -2248,33 +2248,40 @@ st.set_page_config(layout="wide", page_icon='img/icon.ico', page_title='VoucherV
|
|
| 2248 |
# Parse the 'is_hf' argument and set it in session state
|
| 2249 |
if 'is_hf' not in st.session_state:
|
| 2250 |
st.session_state['is_hf'] = True
|
| 2251 |
-
|
| 2252 |
-
|
| 2253 |
-
|
| 2254 |
-
|
| 2255 |
-
|
| 2256 |
-
|
| 2257 |
-
|
| 2258 |
-
|
| 2259 |
-
|
| 2260 |
|
| 2261 |
# Default YAML file path
|
| 2262 |
if 'config' not in st.session_state:
|
| 2263 |
st.session_state.config, st.session_state.dir_home = build_VV_config(loaded_cfg=None)
|
| 2264 |
setup_streamlit_config(st.session_state.dir_home)
|
| 2265 |
|
| 2266 |
-
|
| 2267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2268 |
if 'proceed_to_build_llm_prompt' not in st.session_state:
|
| 2269 |
st.session_state.proceed_to_build_llm_prompt = False # New state variable to control the flow
|
| 2270 |
if 'proceed_to_private' not in st.session_state:
|
| 2271 |
st.session_state.proceed_to_private = False # New state variable to control the flow
|
| 2272 |
|
| 2273 |
|
| 2274 |
-
|
| 2275 |
-
st.session_state.private_file = does_private_file_exist()
|
| 2276 |
-
if st.session_state.private_file:
|
| 2277 |
-
st.session_state.proceed_to_main = True
|
| 2278 |
|
| 2279 |
|
| 2280 |
if 'processing_add_on' not in st.session_state:
|
|
@@ -2362,11 +2369,11 @@ if 'proceed_to_space_saver' not in st.session_state:
|
|
| 2362 |
# Main ##########################################################################################################################################
|
| 2363 |
#################################################################################################################################################
|
| 2364 |
|
| 2365 |
-
|
| 2366 |
-
|
| 2367 |
if st.session_state.proceed_to_build_llm_prompt:
|
| 2368 |
build_LLM_prompt_config()
|
| 2369 |
-
|
| 2370 |
-
|
| 2371 |
elif st.session_state.proceed_to_main:
|
| 2372 |
main()
|
|
|
|
| 1854 |
# Load the image only if it's not already in the session state
|
| 1855 |
if "demo_collage" not in st.session_state:
|
| 1856 |
# ba = os.path.join(st.session_state.dir_home, 'demo', 'ba', 'ba2.png')
|
| 1857 |
+
ba = os.path.join(st.session_state.dir_home, 'demo', 'ba', 'ba2.PNG')
|
| 1858 |
st.session_state["demo_collage"] = Image.open(ba)
|
| 1859 |
|
| 1860 |
# Display the image
|
| 1861 |
+
st.image(st.session_state["demo_collage"], caption='LeafMachine2 Collage', output_format="PNG")
|
| 1862 |
+
# st.image(st.session_state["demo_collage"], caption='LeafMachine2 Collage', output_format="JPEG")
|
| 1863 |
|
| 1864 |
|
| 1865 |
|
|
|
|
| 1928 |
with col_ocr_2:
|
| 1929 |
if "demo_overlay" not in st.session_state:
|
| 1930 |
# ocr = os.path.join(st.session_state.dir_home,'demo', 'ba','ocr.png')
|
| 1931 |
+
ocr = os.path.join(st.session_state.dir_home,'demo', 'ba','ocr2_low.png')
|
| 1932 |
st.session_state["demo_overlay"] = Image.open(ocr)
|
| 1933 |
|
| 1934 |
+
st.image(st.session_state["demo_overlay"], caption='OCR Overlay Images', output_format = "PNG")
|
| 1935 |
+
# st.image(st.session_state["demo_overlay"], caption='OCR Overlay Images', output_format = "JPEG")
|
| 1936 |
|
| 1937 |
|
| 1938 |
|
|
|
|
| 2248 |
# Parse the 'is_hf' argument and set it in session state
|
| 2249 |
if 'is_hf' not in st.session_state:
|
| 2250 |
st.session_state['is_hf'] = True
|
| 2251 |
+
try:
|
| 2252 |
+
is_hf_arg = parse_command_line_argument('is_hf')
|
| 2253 |
+
if is_hf_arg == '1':
|
| 2254 |
+
st.session_state['is_hf'] = True
|
| 2255 |
+
else:
|
| 2256 |
+
st.session_state['is_hf'] = False
|
| 2257 |
+
except:
|
| 2258 |
+
st.session_state['is_hf'] = True
|
|
|
|
| 2259 |
|
| 2260 |
# Default YAML file path
|
| 2261 |
if 'config' not in st.session_state:
|
| 2262 |
st.session_state.config, st.session_state.dir_home = build_VV_config(loaded_cfg=None)
|
| 2263 |
setup_streamlit_config(st.session_state.dir_home)
|
| 2264 |
|
| 2265 |
+
|
| 2266 |
+
if st.session_state['is_hf']:
|
| 2267 |
+
if 'proceed_to_main' not in st.session_state:
|
| 2268 |
+
st.session_state.proceed_to_main = True
|
| 2269 |
+
|
| 2270 |
+
else:
|
| 2271 |
+
if 'proceed_to_main' not in st.session_state:
|
| 2272 |
+
st.session_state.proceed_to_main = False # New state variable to control the flow
|
| 2273 |
+
if 'private_file' not in st.session_state:
|
| 2274 |
+
st.session_state.private_file = does_private_file_exist()
|
| 2275 |
+
if st.session_state.private_file:
|
| 2276 |
+
st.session_state.proceed_to_main = True
|
| 2277 |
+
|
| 2278 |
if 'proceed_to_build_llm_prompt' not in st.session_state:
|
| 2279 |
st.session_state.proceed_to_build_llm_prompt = False # New state variable to control the flow
|
| 2280 |
if 'proceed_to_private' not in st.session_state:
|
| 2281 |
st.session_state.proceed_to_private = False # New state variable to control the flow
|
| 2282 |
|
| 2283 |
|
| 2284 |
+
|
|
|
|
|
|
|
|
|
|
| 2285 |
|
| 2286 |
|
| 2287 |
if 'processing_add_on' not in st.session_state:
|
|
|
|
| 2369 |
# Main ##########################################################################################################################################
|
| 2370 |
#################################################################################################################################################
|
| 2371 |
|
| 2372 |
+
if not st.session_state.private_file and not st.session_state['is_hf']:
|
| 2373 |
+
create_private_file()
|
| 2374 |
if st.session_state.proceed_to_build_llm_prompt:
|
| 2375 |
build_LLM_prompt_config()
|
| 2376 |
+
elif st.session_state.proceed_to_private and not st.session_state['is_hf']:
|
| 2377 |
+
create_private_file()
|
| 2378 |
elif st.session_state.proceed_to_main:
|
| 2379 |
main()
|
demo/ba/ba2.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
demo/ba/ba2_low.png
ADDED
|
Git LFS Details
|
demo/ba/ocr2.png
ADDED
|
Git LFS Details
|
demo/ba/ocr2_low.png
ADDED
|
Git LFS Details
|