bano1 commited on
Commit
aaf1367
·
verified ·
1 Parent(s): f42a653

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -19
app.py CHANGED
@@ -418,28 +418,15 @@ with tabs[1]:
418
  st.header("Upload PDFs")
419
  uploaded_files = st.file_uploader("Upload research papers (PDF)", type="pdf", accept_multiple_files=True)
420
  if uploaded_files:
421
- analysis_mode = st.radio(
422
- "Choose Analysis Mode:",
423
- ["Basic (Summary only)", "Full (Summary + Gaps + Limitations + Sections)"],
424
- index=0
425
- )
426
-
427
  for file in uploaded_files:
428
  file.seek(0)
429
  meta = extract_metadata(file)
 
430
  text_for_sections = extract_text_from_pdf(file)
431
-
432
  meta["summary"] = get_summary(meta.get("abstract", ""))
433
-
434
- if analysis_mode == "Full":
435
- meta["limitations"] = get_limitations(meta.get("abstract", ""))
436
- meta["research_gaps"] = get_research_gaps(meta.get("abstract", ""))
437
- meta["section_summary"] = get_section_summaries(text_for_sections)
438
- else:
439
- meta["limitations"] = "Skipped (Basic mode)"
440
- meta["research_gaps"] = "Skipped (Basic mode)"
441
- meta["section_summary"] = "Skipped (Basic mode)"
442
-
443
  # Extract keywords
444
  try:
445
  keywords = kw_model.extract_keywords(meta.get("abstract", ""), top_n=5)
@@ -532,7 +519,6 @@ with tabs[6]:
532
  prompt = f"""You are an academic assistant. Use the following abstracts as context and answer the question concisely and precisely. If the required info is not available in the abstracts, say you don't have enough info.
533
  Context (abstracts):
534
  {combined_abstracts}
535
-
536
  Question:
537
  {user_q}
538
  """
@@ -543,4 +529,4 @@ Question:
543
  st.markdown("### 🧠 Answer:")
544
  st.write(response.choices[0].message.content.strip())
545
  else:
546
- st.info("Upload papers first.")
 
418
  st.header("Upload PDFs")
419
  uploaded_files = st.file_uploader("Upload research papers (PDF)", type="pdf", accept_multiple_files=True)
420
  if uploaded_files:
 
 
 
 
 
 
421
  for file in uploaded_files:
422
  file.seek(0)
423
  meta = extract_metadata(file)
424
+ # section-wise summary (model may be slower; optional)
425
  text_for_sections = extract_text_from_pdf(file)
426
+ meta["section_summary"] = get_section_summaries(text_for_sections)
427
  meta["summary"] = get_summary(meta.get("abstract", ""))
428
+ meta["limitations"] = get_limitations(meta.get("abstract", ""))
429
+ meta["research_gaps"] = get_research_gaps(meta.get("abstract", ""))
 
 
 
 
 
 
 
 
430
  # Extract keywords
431
  try:
432
  keywords = kw_model.extract_keywords(meta.get("abstract", ""), top_n=5)
 
519
  prompt = f"""You are an academic assistant. Use the following abstracts as context and answer the question concisely and precisely. If the required info is not available in the abstracts, say you don't have enough info.
520
  Context (abstracts):
521
  {combined_abstracts}
 
522
  Question:
523
  {user_q}
524
  """
 
529
  st.markdown("### 🧠 Answer:")
530
  st.write(response.choices[0].message.content.strip())
531
  else:
532
+ st.info("Upload papers first.")