NikosKprl commited on
Commit
30266af
·
verified ·
1 Parent(s): f0be77b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -22,6 +22,15 @@ if not os.path.exists(folder_path):
22
  else:
23
  print(f"Folder 'qids_folder' already exists.")
24
 
 
 
 
 
 
 
 
 
 
25
  model = SentenceTransformer("Lajavaness/bilingual-embedding-large", trust_remote_code=True)
26
 
27
  token = os.environ["GITHUB_TOKEN"]
@@ -257,7 +266,7 @@ async def retriever(qid):
257
 
258
  # Main async function to handle multiple QIDs with batching
259
  async def main(name):
260
- with open(f"qids_folder/{name}.json", "r") as f:
261
  final_list = []
262
  qids = json.load(f)
263
  for q in qids:
@@ -265,7 +274,7 @@ async def main(name):
265
  if returned_list:
266
  final_list.extend(returned_list)
267
 
268
- with open(f"info_extraction/{name}.json", "w", encoding="utf-8") as flast:
269
  json.dump(final_list, flast)
270
 
271
  def check_sentence(sentence):
@@ -428,7 +437,7 @@ def main_cli():
428
  for i,j,o in zip(list_with_full_names,list_with_contexts,list_with_names_to_show):
429
  number += 1
430
  st.write(f"Applying Candidate Selection module... (4/5) [{number}/{len(list_with_full_names)}]")
431
- with open(f"info_extraction/{i}.json", "r") as f:
432
  json_file = json.load(f)
433
  lista = []
434
  lista_1 = []
 
22
  else:
23
  print(f"Folder 'qids_folder' already exists.")
24
 
25
+
26
+ folder_path_1 = '/home/user/app/info_extraction'
27
+
28
+ if not os.path.exists(folder_path_1):
29
+ os.mkdir(folder_path_1)
30
+ print(f"Folder 'qids_folder' created at {folder_path_1}")
31
+ else:
32
+ print(f"Folder 'qids_folder' already exists.")
33
+
34
  model = SentenceTransformer("Lajavaness/bilingual-embedding-large", trust_remote_code=True)
35
 
36
  token = os.environ["GITHUB_TOKEN"]
 
266
 
267
  # Main async function to handle multiple QIDs with batching
268
  async def main(name):
269
+ with open(f"/home/user/app/qids_folder/{name}.json", "r") as f:
270
  final_list = []
271
  qids = json.load(f)
272
  for q in qids:
 
274
  if returned_list:
275
  final_list.extend(returned_list)
276
 
277
+ with open(f"/home/user/app/info_extraction/{name}.json", "w", encoding="utf-8") as flast:
278
  json.dump(final_list, flast)
279
 
280
  def check_sentence(sentence):
 
437
  for i,j,o in zip(list_with_full_names,list_with_contexts,list_with_names_to_show):
438
  number += 1
439
  st.write(f"Applying Candidate Selection module... (4/5) [{number}/{len(list_with_full_names)}]")
440
+ with open(f"/home/user/app/info_extraction/{i}.json", "r") as f:
441
  json_file = json.load(f)
442
  lista = []
443
  lista_1 = []