Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,18 @@ titles = {"shoe-sizes": "Shoes sizes should be the same for both men and women",
|
|
| 21 |
"best-time-period": "Today is the best time period in human history to be alive for the vast majority of people",
|
| 22 |
}
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
def result_html(result):
|
| 26 |
return (
|
|
@@ -51,9 +63,14 @@ with col2:
|
|
| 51 |
|
| 52 |
|
| 53 |
if search_query or button_clicked:
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
with st.expander("Instructions", expanded=False):
|
| 59 |
st.markdown(
|
|
|
|
| 21 |
"best-time-period": "Today is the best time period in human history to be alive for the vast majority of people",
|
| 22 |
}
|
| 23 |
|
| 24 |
+
num_docs = {"shoe-sizes": 623,
|
| 25 |
+
"social-media": 1133,
|
| 26 |
+
"depression": 982,
|
| 27 |
+
"metric-system": 4679,
|
| 28 |
+
"best-time-period": 2516,
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
cmv'-the-others-have-it-worse-argument-is-terrible-and-should-never-be-used-in-an-actual-conversation-with-a-depressed-person 982
|
| 32 |
+
cmv'-today-is-the-best-time-period-in-human-history-to-be-alive-for-the-vast-majority-of-people. 2516
|
| 33 |
+
cmv'-there-shouldnt-be-anything-other-than-the-metric-system. 4679
|
| 34 |
+
cmv'-shoe-sizes-should-be-the-same-for-both-men-and-women 623
|
| 35 |
+
cmv'-social-media-is-the-most-destructive-addiction-in-our-society 1133
|
| 36 |
|
| 37 |
def result_html(result):
|
| 38 |
return (
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
if search_query or button_clicked:
|
| 66 |
+
k=num_docs[discussion]
|
| 67 |
+
search_results = searcher.search(search_query, k=k)
|
| 68 |
+
if len(search_results) == 0:
|
| 69 |
+
st.write("Retrieved 0 documents")
|
| 70 |
+
else:
|
| 71 |
+
st.write(f"retrieved {len(search_results)} out of {k} total posts")
|
| 72 |
+
for result in search_results:
|
| 73 |
+
st.write(result_html(result), unsafe_allow_html=True)
|
| 74 |
|
| 75 |
with st.expander("Instructions", expanded=False):
|
| 76 |
st.markdown(
|