Spaces:
Sleeping
Sleeping
Fix
Browse files
app.py
CHANGED
|
@@ -129,8 +129,11 @@ def update_df(
|
|
| 129 |
raise gr.Error(str(e)) from e
|
| 130 |
else:
|
| 131 |
paper_ids, scores = semantic_search(search_query, candidate_pool_size, score_threshold)
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
if presentation_type != "(ALL)":
|
| 136 |
df = df.filter(pl.col("Type").str.contains(presentation_type))
|
|
|
|
| 129 |
raise gr.Error(str(e)) from e
|
| 130 |
else:
|
| 131 |
paper_ids, scores = semantic_search(search_query, candidate_pool_size, score_threshold)
|
| 132 |
+
if not paper_ids:
|
| 133 |
+
df = df.head(0)
|
| 134 |
+
else:
|
| 135 |
+
df = pl.DataFrame({"paper_id": paper_ids, "score": scores}).join(df, on="paper_id", how="inner")
|
| 136 |
+
df = df.sort("score", descending=True).drop("score")
|
| 137 |
|
| 138 |
if presentation_type != "(ALL)":
|
| 139 |
df = df.filter(pl.col("Type").str.contains(presentation_type))
|