Testys commited on
Commit
e8bab50
·
verified ·
1 Parent(s): 0dc279f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -0
app.py CHANGED
@@ -1,4 +1,8 @@
1
  import streamlit as st
 
 
 
 
2
  from search_utils import SemanticSearch
3
  import logging
4
  import time
@@ -9,6 +13,28 @@ import re
9
  from pathlib import Path
10
  from urllib.parse import urlparse
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  # Configure logging
13
  logging.basicConfig(
14
  level=logging.INFO,
@@ -99,6 +125,18 @@ def main():
99
  margin: 10px 0;
100
  background: #fff;
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
102
  </style>
103
  """, unsafe_allow_html=True)
104
 
@@ -189,5 +227,15 @@ def main():
189
  st.cache_resource.clear()
190
  st.rerun()
191
 
 
 
 
 
 
 
 
 
 
 
192
  if __name__ == "__main__":
193
  main()
 
1
  import streamlit as st
2
+ import schedule
3
+ import time
4
+ import requests
5
+ import threading
6
  from search_utils import SemanticSearch
7
  import logging
8
  import time
 
13
  from pathlib import Path
14
  from urllib.parse import urlparse
15
 
16
+
17
+ def ping_server():
18
+ try:
19
+ print("Pinging server")
20
+ response = requests.get("https://testys-semantic-search.hf.space")
21
+ except requests.exceptions.RequestException as e:
22
+ print("Server is down")
23
+
24
+ schedule.every(10).minutes.do(ping_server)
25
+
26
+
27
+ def run_schedule():
28
+ while True:
29
+ schedule.run_pending()
30
+ time.sleep(1)
31
+
32
+
33
+ thread = threading.Thread(target=run_schedule)
34
+ thread.daemon = True
35
+ thread.start()
36
+
37
+
38
  # Configure logging
39
  logging.basicConfig(
40
  level=logging.INFO,
 
125
  margin: 10px 0;
126
  background: #fff;
127
  }
128
+ /* Footer styling */
129
+ .footer {
130
+ position: fixed;
131
+ left: 0;
132
+ bottom: 0;
133
+ width: 100%;
134
+ background-color: #f8f9fa;
135
+ text-align: center;
136
+ padding: 0.5rem;
137
+ font-size: 1rem;
138
+ border-top: 1px solid #ccc;
139
+ }
140
  </style>
141
  """, unsafe_allow_html=True)
142
 
 
227
  st.cache_resource.clear()
228
  st.rerun()
229
 
230
+
231
+ # Footer
232
+ st.markdown("""
233
+ <div class="footer">
234
+ <small>&copy; 2025 Joel Adesanya's MSc Project. </small>
235
+ <br/>
236
+ <em>"Research Paper Semantic Search Engine"</em>
237
+ </div>
238
+ """, unsafe_allow_html=True)
239
+
240
  if __name__ == "__main__":
241
  main()