phyloforfun commited on
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
Files changed (5) hide show
  1. app.py +32 -25
  2. demo/ba/ba2.png +2 -2
  3. demo/ba/ba2_low.png +3 -0
  4. demo/ba/ocr2.png +3 -0
  5. 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.jpg')
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,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','ocr.jpg')
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,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
- # 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
 
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
- if 'proceed_to_main' not in st.session_state:
2267
- st.session_state.proceed_to_main = False # New state variable to control the flow
 
 
 
 
 
 
 
 
 
 
 
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
- if 'private_file' not in st.session_state:
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
- # if not st.session_state.private_file and not st.session_state['is_hf']:
2366
- # create_private_file()
2367
  if st.session_state.proceed_to_build_llm_prompt:
2368
  build_LLM_prompt_config()
2369
- # elif st.session_state.proceed_to_private and not st.session_state['is_hf']:
2370
- # create_private_file()
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

  • SHA256: 917ca82feb01334499b95113f9bf6e4dfb0ca8f68d33c886ca2879039dd489be
  • Pointer size: 132 Bytes
  • Size of remote file: 4.56 MB

Git LFS Details

  • SHA256: 61dcf002c4687afe4987b11f115c43b469095c502de25d6da182b07b0877e87d
  • Pointer size: 132 Bytes
  • Size of remote file: 4.56 MB
demo/ba/ba2_low.png ADDED

Git LFS Details

  • SHA256: 53fa54275da02860c3e01014215331e01d0f2c34b8272eb8e624ace9fec1a174
  • Pointer size: 131 Bytes
  • Size of remote file: 736 kB
demo/ba/ocr2.png ADDED

Git LFS Details

  • SHA256: da500b20ad66ec619a8bc9e18d655178bb60023a27efdb27223abb68fff5bfe0
  • Pointer size: 132 Bytes
  • Size of remote file: 6.69 MB
demo/ba/ocr2_low.png ADDED

Git LFS Details

  • SHA256: cd7c3474bac5dd4c87c0da04bdce29736953bc62c98fc5a10a13f1b8fe3471ff
  • Pointer size: 132 Bytes
  • Size of remote file: 1.08 MB