Spaces:
Sleeping
Sleeping
Commit
·
ad883ad
1
Parent(s):
3f3e390
app.py
CHANGED
@@ -451,27 +451,27 @@ def find_synergistic_papers(abstract: str, limit=25) -> list[dict]:
|
|
451 |
return papers
|
452 |
|
453 |
|
454 |
-
def format_search_results(abstract: str) -> dict:
|
455 |
-
"""Format search results as a
|
456 |
# Find papers synergistic with the given abstract
|
457 |
papers = find_synergistic_papers(abstract)
|
458 |
|
459 |
# Convert to DataFrame for display
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
|
474 |
-
return
|
475 |
|
476 |
|
477 |
def format_paper_as_markdown(paper: dict) -> str:
|
|
|
451 |
return papers
|
452 |
|
453 |
|
454 |
+
def format_search_results(abstract: str) -> tuple[pd.DataFrame, list[dict]]:
|
455 |
+
"""Format search results as a DataFrame for display"""
|
456 |
# Find papers synergistic with the given abstract
|
457 |
papers = find_synergistic_papers(abstract)
|
458 |
|
459 |
# Convert to DataFrame for display
|
460 |
+
df = pd.DataFrame(
|
461 |
+
[
|
462 |
+
{
|
463 |
+
"Title": p["title"],
|
464 |
+
"Authors": p["authors"][:50] + "..." if len(p["authors"]) > 50 else p["authors"],
|
465 |
+
"Categories": p["categories"],
|
466 |
+
"Date": p["update_date"],
|
467 |
+
"Match Score": f"{int(p['synergy_score'] * 100)}%",
|
468 |
+
"ID": p["id"], # Hidden column for reference
|
469 |
+
}
|
470 |
+
for p in papers
|
471 |
+
]
|
472 |
+
)
|
473 |
|
474 |
+
return df, papers # Return both DataFrame and original data
|
475 |
|
476 |
|
477 |
def format_paper_as_markdown(paper: dict) -> str:
|