Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
|
@@ -32,14 +32,6 @@ st.sidebar.markdown(
|
|
| 32 |
text-align: center;
|
| 33 |
}
|
| 34 |
</style>
|
| 35 |
-
<p style='text-align: center'>
|
| 36 |
-
<a href="" >GitHub</a> | <a href="" >Project Report</a>
|
| 37 |
-
</p>
|
| 38 |
-
<p class="aligncenter">
|
| 39 |
-
<a href="" target="_blank">
|
| 40 |
-
<img src="https://colab.research.google.com/assets/colab-badge.svg"/>
|
| 41 |
-
</a>
|
| 42 |
-
</p>
|
| 43 |
""",
|
| 44 |
unsafe_allow_html=True,
|
| 45 |
)
|
|
@@ -71,15 +63,18 @@ ds = load_dataset("imdb", split="train")
|
|
| 71 |
def search(query):
|
| 72 |
hits = searcher.search(query, k=10)
|
| 73 |
results = ds.select([int(hit.docid) for hit in hits])
|
| 74 |
-
return results
|
| 75 |
|
| 76 |
|
| 77 |
if st.sidebar.button("Search"):
|
| 78 |
results = search(query)
|
|
|
|
|
|
|
|
|
|
| 79 |
rendered_results = f"""
|
| 80 |
<div id="searchresultsarea">
|
| 81 |
<br>
|
| 82 |
-
{
|
| 83 |
</div>
|
| 84 |
"""
|
| 85 |
st.markdown(
|
|
|
|
| 32 |
text-align: center;
|
| 33 |
}
|
| 34 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
""",
|
| 36 |
unsafe_allow_html=True,
|
| 37 |
)
|
|
|
|
| 63 |
def search(query):
|
| 64 |
hits = searcher.search(query, k=10)
|
| 65 |
results = ds.select([int(hit.docid) for hit in hits])
|
| 66 |
+
return results["text"]
|
| 67 |
|
| 68 |
|
| 69 |
if st.sidebar.button("Search"):
|
| 70 |
results = search(query)
|
| 71 |
+
results_html = ""
|
| 72 |
+
for result in results:
|
| 73 |
+
results_html += result + "<br><hr><br>"
|
| 74 |
rendered_results = f"""
|
| 75 |
<div id="searchresultsarea">
|
| 76 |
<br>
|
| 77 |
+
{results_html}
|
| 78 |
</div>
|
| 79 |
"""
|
| 80 |
st.markdown(
|