Sarthak005 commited on
Commit
a31b365
·
verified ·
1 Parent(s): 2b5e319

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -483,7 +483,7 @@ async def query(request: QueryRequest):
483
  model_name="BAAI/bge-small-en", model_kwargs={"device": "cpu"}
484
  )
485
  jif = impact_factor # Minimum JIF value for filtering
486
- publisher = preferred_publisher # Preferred publisher list or "no preference"
487
 
488
  # Load the FAISS index from local storage
489
  db1 = FAISS.load_local(DB_FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
@@ -528,18 +528,31 @@ async def query(request: QueryRequest):
528
  # Filter based on JIF and publisher preferences
529
  if jif_value >= min_jif :
530
  # Create the Journal model instance
531
- journal = Journal(
532
- id=len(journal_list) + 1, # Incrementing ID for each journal
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  Name=name_value,
534
  JIF=jif_value,
535
  Category=category_value,
536
  Keywords=keywords_value,
537
  Publisher=publisher_value,
538
- Decision_Time = decision_time
539
- )
 
 
540
 
541
- # Add the journal to the list
542
- journal_list.append(journal)
543
 
544
  # Return the list of journals as a response or process it further
545
  return {"result": [journal.dict() for journal in journal_list]}
 
483
  model_name="BAAI/bge-small-en", model_kwargs={"device": "cpu"}
484
  )
485
  jif = impact_factor # Minimum JIF value for filtering
486
+ publisher = preferred_publisher.split() if preferred_publisher else [] # Preferred publisher list or "no preference"
487
 
488
  # Load the FAISS index from local storage
489
  db1 = FAISS.load_local(DB_FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
 
528
  # Filter based on JIF and publisher preferences
529
  if jif_value >= min_jif :
530
  # Create the Journal model instance
531
+ if publisher and (publisher_value in publisher):
532
+ print("inside pubisher match")
533
+ journal = Journal(
534
+ id=len(journal_list) + 1,
535
+ Name=name_value,
536
+ JIF=jif_value,
537
+ Category=category_value,
538
+ Keywords=keywords_value,
539
+ Publisher=publisher_value,
540
+ Decision_Time=decision_time
541
+ )
542
+ journal_list.append(journal)
543
+ elif not publisher:
544
+ journal = Journal(
545
+ id=len(journal_list) + 1,
546
  Name=name_value,
547
  JIF=jif_value,
548
  Category=category_value,
549
  Keywords=keywords_value,
550
  Publisher=publisher_value,
551
+ Decision_Time=decision_time
552
+ )
553
+ journal_list.append(journal)
554
+
555
 
 
 
556
 
557
  # Return the list of journals as a response or process it further
558
  return {"result": [journal.dict() for journal in journal_list]}