Spaces:
Running
Running
Commit
•
cd6abe6
1
Parent(s):
cf61e60
quick fixes
Browse files- pages/search_engine.py +1 -1
- server/api.py +2 -4
pages/search_engine.py
CHANGED
@@ -131,7 +131,7 @@ def page():
|
|
131 |
col2.metric("N° downloads", numerize(hit["downloads"]))
|
132 |
col3.metric("N° likes", numerize(hit["likes"]))
|
133 |
st.button(f"View model on 🤗", on_click=lambda hit=hit: webbrowser.open(f"https://huggingface.co/{hit['modelId']}"), key=hit["modelId"])
|
134 |
-
st.
|
135 |
|
136 |
if hit["readme"]:
|
137 |
with st.expander("See README"):
|
|
|
131 |
col2.metric("N° downloads", numerize(hit["downloads"]))
|
132 |
col3.metric("N° likes", numerize(hit["likes"]))
|
133 |
st.button(f"View model on 🤗", on_click=lambda hit=hit: webbrowser.open(f"https://huggingface.co/{hit['modelId']}"), key=hit["modelId"])
|
134 |
+
st.write(f"**Tags:** {' • '.join(hit['tags'])}")
|
135 |
|
136 |
if hit["readme"]:
|
137 |
with st.expander("See README"):
|
server/api.py
CHANGED
@@ -56,8 +56,7 @@ def semantic_search():
|
|
56 |
print("filters", filters)
|
57 |
print("limit", limit)
|
58 |
|
59 |
-
|
60 |
-
hits = hf_search(query=query, method="retrieve & rerank", limit=limit)
|
61 |
hits = [
|
62 |
{
|
63 |
"modelId": hit["modelId"],
|
@@ -92,8 +91,7 @@ def bm25_search():
|
|
92 |
}
|
93 |
for hit in hits
|
94 |
]
|
95 |
-
|
96 |
-
|
97 |
return json.dumps({"value": hits, "count": len(hits)})
|
98 |
|
99 |
|
|
|
56 |
print("filters", filters)
|
57 |
print("limit", limit)
|
58 |
|
59 |
+
hits = hf_search(query=query, method="retrieve & rerank", limit=limit, filters=filters)
|
|
|
60 |
hits = [
|
61 |
{
|
62 |
"modelId": hit["modelId"],
|
|
|
91 |
}
|
92 |
for hit in hits
|
93 |
]
|
94 |
+
hits = [hits[i] for i in range(len(hits)) if hits[i]["modelId"] not in [h["modelId"] for h in hits[:i]]] # unique hits
|
|
|
95 |
return json.dumps({"value": hits, "count": len(hits)})
|
96 |
|
97 |
|