Spaces:
Runtime error
Runtime error
Commit
·
8baf302
1
Parent(s):
d74498f
edits
Browse files
app.py
CHANGED
@@ -84,6 +84,34 @@ max_results = st.sidebar.slider(
|
|
84 |
value=10,
|
85 |
help="Maximum Number of Documents to return",
|
86 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
|
89 |
def scisearch(query, language, num_results=10):
|
@@ -135,11 +163,11 @@ def highlight_string(paragraph: str, highlight_terms: list) -> str:
|
|
135 |
|
136 |
def process_results(hits: list, highlight_terms: list) -> str:
|
137 |
hit_list = []
|
138 |
-
for hit in hits:
|
139 |
res_head = f"""
|
140 |
<div class="searchresult">
|
141 |
-
<h2>Document ID
|
142 |
-
<p>Language
|
143 |
"""
|
144 |
for subhit in hit['meta']['docs']:
|
145 |
res_head += f"""
|
|
|
84 |
value=10,
|
85 |
help="Maximum Number of Documents to return",
|
86 |
)
|
87 |
+
footer="""<style>
|
88 |
+
a:link , a:visited{
|
89 |
+
color: blue;
|
90 |
+
background-color: transparent;
|
91 |
+
text-decoration: underline;
|
92 |
+
}
|
93 |
+
|
94 |
+
a:hover, a:active {
|
95 |
+
color: red;
|
96 |
+
background-color: transparent;
|
97 |
+
text-decoration: underline;
|
98 |
+
}
|
99 |
+
|
100 |
+
.footer {
|
101 |
+
position: fixed;
|
102 |
+
left: 0;
|
103 |
+
bottom: 0;
|
104 |
+
width: 100%;
|
105 |
+
background-color: white;
|
106 |
+
color: black;
|
107 |
+
text-align: center;
|
108 |
+
}
|
109 |
+
</style>
|
110 |
+
<div class="footer">
|
111 |
+
<p>Powered by <a style='display: block; text-align: center;' href="" >HuggingFace</a> and <a style='display: block; text-align: center;' href="" >Pyserini</a></p>
|
112 |
+
</div>
|
113 |
+
"""
|
114 |
+
st.sidebar.markdown(footer,unsafe_allow_html=True)
|
115 |
|
116 |
|
117 |
def scisearch(query, language, num_results=10):
|
|
|
163 |
|
164 |
def process_results(hits: list, highlight_terms: list) -> str:
|
165 |
hit_list = []
|
166 |
+
for i, hit in enumerate(hits):
|
167 |
res_head = f"""
|
168 |
<div class="searchresult">
|
169 |
+
<h2>{i}. Document ID: {hit['docid']}</h2>
|
170 |
+
<p>Language: <string>{hit['lang']}</string>, Score: {round(hit['score'], 2)}</p>
|
171 |
"""
|
172 |
for subhit in hit['meta']['docs']:
|
173 |
res_head += f"""
|