Weedoo commited on
Commit
4151f23
1 Parent(s): 5fd1a0f

add error handling for Keyerror

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -87,8 +87,13 @@ with gr.Blocks() as demo:
87
  ids = get_zotero_ids(zotero_api_key, zotero_library_id, zotero_tag)
88
 
89
  df = get_arxiv_papers(ids)
90
-
91
- embeddings, dim = get_hf_embeddings(hf_api_key, df)
 
 
 
 
 
92
 
93
  feedback = upload_to_pinecone(pinecone_api_key, index_name, namespace_name, embeddings, dim, df)
94
 
 
87
  ids = get_zotero_ids(zotero_api_key, zotero_library_id, zotero_tag)
88
 
89
  df = get_arxiv_papers(ids)
90
+ try:
91
+ embeddings, dim = get_hf_embeddings(hf_api_key, df)
92
+ except KeyError as e:
93
+ print(e)
94
+ print('\n Resetting project...')
95
+ reset_project()
96
+ exit()
97
 
98
  feedback = upload_to_pinecone(pinecone_api_key, index_name, namespace_name, embeddings, dim, df)
99