Spaces:
Running
Running
phyloforfun
commited on
Commit
•
1a14ab7
1
Parent(s):
b3f995d
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
CHANGED
@@ -2256,7 +2256,7 @@ if 'is_hf' not in st.session_state:
|
|
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)
|
@@ -2266,28 +2266,38 @@ if 'config' not in st.session_state:
|
|
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 '
|
2279 |
-
|
2280 |
-
|
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:
|
2288 |
st.session_state['processing_add_on'] = ''
|
2289 |
|
2290 |
-
|
2291 |
if 'formatted_json' not in st.session_state:
|
2292 |
st.session_state['formatted_json'] = None
|
2293 |
if 'formatted_json_WFO' not in st.session_state:
|
@@ -2295,11 +2305,9 @@ if 'formatted_json_WFO' not in st.session_state:
|
|
2295 |
if 'formatted_json_GEO' not in st.session_state:
|
2296 |
st.session_state['formatted_json_GEO'] = None
|
2297 |
|
2298 |
-
|
2299 |
if 'lacks_GPU' not in st.session_state:
|
2300 |
st.session_state['lacks_GPU'] = not torch.cuda.is_available()
|
2301 |
|
2302 |
-
|
2303 |
if 'API_key_validation' not in st.session_state:
|
2304 |
st.session_state['API_key_validation'] = False
|
2305 |
if 'present_annotations' not in st.session_state:
|
@@ -2368,10 +2376,15 @@ if 'proceed_to_space_saver' not in st.session_state:
|
|
2368 |
#################################################################################################################################################
|
2369 |
# Main ##########################################################################################################################################
|
2370 |
#################################################################################################################################################
|
|
|
|
|
|
|
|
|
|
|
2371 |
|
2372 |
if not st.session_state.private_file and not st.session_state['is_hf']:
|
2373 |
create_private_file()
|
2374 |
-
|
2375 |
build_LLM_prompt_config()
|
2376 |
elif st.session_state.proceed_to_private and not st.session_state['is_hf']:
|
2377 |
create_private_file()
|
|
|
2256 |
st.session_state['is_hf'] = False
|
2257 |
except:
|
2258 |
st.session_state['is_hf'] = True
|
2259 |
+
print(f"is_hf {st.session_state['is_hf']}")
|
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)
|
|
|
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 |
+
print(f"proceed_to_main {st.session_state['proceed_to_main']}")
|
2270 |
+
|
2271 |
+
if 'proceed_to_private' not in st.session_state:
|
2272 |
+
st.session_state.proceed_to_private = False
|
2273 |
+
print(f"proceed_to_private {st.session_state['proceed_to_private']}")
|
2274 |
+
|
2275 |
+
if 'private_file' not in st.session_state:
|
2276 |
+
st.session_state.private_file = True
|
2277 |
+
print(f"private_file {st.session_state['private_file']}")
|
2278 |
|
2279 |
else:
|
2280 |
if 'proceed_to_main' not in st.session_state:
|
2281 |
st.session_state.proceed_to_main = False # New state variable to control the flow
|
2282 |
+
print(f"proceed_to_main {st.session_state['proceed_to_main']}")
|
2283 |
if 'private_file' not in st.session_state:
|
2284 |
st.session_state.private_file = does_private_file_exist()
|
2285 |
if st.session_state.private_file:
|
2286 |
st.session_state.proceed_to_main = True
|
2287 |
+
print(f"private_file2 {st.session_state['private_file']}")
|
2288 |
+
print(f"proceed_to_main2 {st.session_state['proceed_to_main']}")
|
2289 |
|
2290 |
+
if 'proceed_to_private' not in st.session_state:
|
2291 |
+
st.session_state.proceed_to_private = False # New state variable to control the flow
|
2292 |
+
print(f"proceed_to_private2 {st.session_state['proceed_to_private']}")
|
|
|
2293 |
|
2294 |
|
2295 |
+
if 'proceed_to_build_llm_prompt' not in st.session_state:
|
2296 |
+
st.session_state.proceed_to_build_llm_prompt = False # New state variable to control the flow
|
2297 |
|
2298 |
if 'processing_add_on' not in st.session_state:
|
2299 |
st.session_state['processing_add_on'] = ''
|
2300 |
|
|
|
2301 |
if 'formatted_json' not in st.session_state:
|
2302 |
st.session_state['formatted_json'] = None
|
2303 |
if 'formatted_json_WFO' not in st.session_state:
|
|
|
2305 |
if 'formatted_json_GEO' not in st.session_state:
|
2306 |
st.session_state['formatted_json_GEO'] = None
|
2307 |
|
|
|
2308 |
if 'lacks_GPU' not in st.session_state:
|
2309 |
st.session_state['lacks_GPU'] = not torch.cuda.is_available()
|
2310 |
|
|
|
2311 |
if 'API_key_validation' not in st.session_state:
|
2312 |
st.session_state['API_key_validation'] = False
|
2313 |
if 'present_annotations' not in st.session_state:
|
|
|
2376 |
#################################################################################################################################################
|
2377 |
# Main ##########################################################################################################################################
|
2378 |
#################################################################################################################################################
|
2379 |
+
print(f"proceed_to_main3 {st.session_state['proceed_to_main']}")
|
2380 |
+
print(f"is_hf3 {st.session_state['is_hf']}")
|
2381 |
+
print(f"private_file3 {st.session_state['private_file']}")
|
2382 |
+
print(f"proceed_to_build_llm_prompt3 {st.session_state['proceed_to_build_llm_prompt']}")
|
2383 |
+
print(f"proceed_to_private3 {st.session_state['proceed_to_private']}")
|
2384 |
|
2385 |
if not st.session_state.private_file and not st.session_state['is_hf']:
|
2386 |
create_private_file()
|
2387 |
+
elif st.session_state.proceed_to_build_llm_prompt:
|
2388 |
build_LLM_prompt_config()
|
2389 |
elif st.session_state.proceed_to_private and not st.session_state['is_hf']:
|
2390 |
create_private_file()
|