Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,15 +41,15 @@ from utils import bm25_tokenize
|
|
| 41 |
# Search function (UI entry)
|
| 42 |
# -----------------------------
|
| 43 |
|
| 44 |
-
def search_hadith(query):
|
| 45 |
if query.strip() == "":
|
| 46 |
-
return pd.DataFrame(columns=["الموضوع", "نص الحديث"])
|
| 47 |
-
|
| 48 |
results_df, _ = hybrid_search_fixed(
|
| 49 |
query=query,
|
| 50 |
df=df,
|
| 51 |
bm25=bm25,
|
| 52 |
-
preprocess_query=
|
| 53 |
model=model,
|
| 54 |
hadith_embeddings=hadith_embeddings,
|
| 55 |
anchor_index=anchor_index,
|
|
@@ -58,11 +58,11 @@ def search_hadith(query):
|
|
| 58 |
top_k=int(top_k)
|
| 59 |
)
|
| 60 |
|
| 61 |
-
return results_df[["main_subj", "clean_text","url"]] \
|
| 62 |
.rename(columns={
|
| 63 |
"main_subj": "الموضوع",
|
| 64 |
"clean_text": "نص الحديث",
|
| 65 |
-
"url":"hadith page on Islamweb.net"
|
| 66 |
})
|
| 67 |
|
| 68 |
|
|
|
|
| 41 |
# Search function (UI entry)
|
| 42 |
# -----------------------------
|
| 43 |
|
| 44 |
+
def search_hadith(query, top_k):
|
| 45 |
if query.strip() == "":
|
| 46 |
+
return pd.DataFrame(columns=["الموضوع", "نص الحديث", "hadith page on Islamweb.net"])
|
| 47 |
+
|
| 48 |
results_df, _ = hybrid_search_fixed(
|
| 49 |
query=query,
|
| 50 |
df=df,
|
| 51 |
bm25=bm25,
|
| 52 |
+
preprocess_query=bm25_tokenize,
|
| 53 |
model=model,
|
| 54 |
hadith_embeddings=hadith_embeddings,
|
| 55 |
anchor_index=anchor_index,
|
|
|
|
| 58 |
top_k=int(top_k)
|
| 59 |
)
|
| 60 |
|
| 61 |
+
return results_df[["main_subj", "clean_text", "url"]] \
|
| 62 |
.rename(columns={
|
| 63 |
"main_subj": "الموضوع",
|
| 64 |
"clean_text": "نص الحديث",
|
| 65 |
+
"url": "hadith page on Islamweb.net"
|
| 66 |
})
|
| 67 |
|
| 68 |
|