Spaces:
Runtime error
Runtime error
ToluClassics
commited on
Commit
·
d74498f
1
Parent(s):
7f8a4d1
Docker
Browse files
app.py
CHANGED
@@ -143,7 +143,9 @@ def process_results(hits: list, highlight_terms: list) -> str:
|
|
143 |
"""
|
144 |
for subhit in hit['meta']['docs']:
|
145 |
res_head += f"""
|
146 |
-
<
|
|
|
|
|
147 |
<p>{highlight_string(subhit['TEXT'], highlight_terms)}</p>
|
148 |
"""
|
149 |
res_head += f"""
|
@@ -217,26 +219,22 @@ if st.sidebar.button("Search"):
|
|
217 |
color: green;
|
218 |
margin-bottom: 0px;
|
219 |
}
|
220 |
-
|
221 |
-
.searchresult button {
|
222 |
-
font-size: 10px;
|
223 |
-
line-height: 14px;
|
224 |
-
color: green;
|
225 |
-
margin-bottom: 0px;
|
226 |
-
padding: 0px;
|
227 |
-
border-width: 0px;
|
228 |
-
background-color: white;
|
229 |
-
}
|
230 |
-
|
231 |
.dark-mode {
|
232 |
color: white;
|
233 |
}
|
234 |
</style>
|
235 |
<script>
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
function myFunction() {
|
241 |
var element = document.body;
|
242 |
element.classList.toggle("dark-mode");
|
|
|
143 |
"""
|
144 |
for subhit in hit['meta']['docs']:
|
145 |
res_head += f"""
|
146 |
+
<button onclick="load_image({subhit['_id']})">Load Image</button><br>
|
147 |
+
<p><img id='{subhit['_id']}' src='{subhit['URL']}' style="width:400px;height:auto;display:none;"></p>
|
148 |
+
<a href='{subhit['URL']}'>{subhit['URL']}</a>
|
149 |
<p>{highlight_string(subhit['TEXT'], highlight_terms)}</p>
|
150 |
"""
|
151 |
res_head += f"""
|
|
|
219 |
color: green;
|
220 |
margin-bottom: 0px;
|
221 |
}
|
222 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
.dark-mode {
|
224 |
color: white;
|
225 |
}
|
226 |
</style>
|
227 |
<script>
|
228 |
+
function load_image(id){
|
229 |
+
console.log(id)
|
230 |
+
var x = document.getElementById(id);
|
231 |
+
console.log(x)
|
232 |
+
if (x.style.display === "none") {
|
233 |
+
x.style.display = "block";
|
234 |
+
} else {
|
235 |
+
x.style.display = "none";
|
236 |
+
}
|
237 |
+
};
|
238 |
function myFunction() {
|
239 |
var element = document.body;
|
240 |
element.classList.toggle("dark-mode");
|