Spaces:
Running
Running
ksvmuralidhar
commited on
Commit
•
4637556
1
Parent(s):
9619e30
Update app.py
Browse files
app.py
CHANGED
@@ -134,6 +134,7 @@ def index():
|
|
134 |
"""
|
135 |
try:
|
136 |
src_str = ''
|
|
|
137 |
final_df, freq_tokens = fetch_from_db(is_db_fetch_reqd())
|
138 |
if len(final_df) > 1:
|
139 |
|
@@ -169,6 +170,7 @@ def index():
|
|
169 |
|
170 |
if len(final_df) <= 1:
|
171 |
result_str += f'''<div><p class="unavailable">This app is temporarily unavailable</p></div>'''
|
|
|
172 |
else:
|
173 |
last_update_utc = datetime.strptime(redis_client.get('NEWSFETCHTIME'), '%Y-%m-%d %H:%M:%S.%f')
|
174 |
last_update_mins = int(np.ceil((datetime.now() - last_update_utc).seconds / 60))
|
@@ -234,7 +236,7 @@ def index():
|
|
234 |
'''
|
235 |
|
236 |
result_str += '</form></div>'
|
237 |
-
return render_template("index.html", body=result_str)
|
238 |
|
239 |
|
240 |
if __name__ == "__main__":
|
|
|
134 |
"""
|
135 |
try:
|
136 |
src_str = ''
|
137 |
+
status_code = 200
|
138 |
final_df, freq_tokens = fetch_from_db(is_db_fetch_reqd())
|
139 |
if len(final_df) > 1:
|
140 |
|
|
|
170 |
|
171 |
if len(final_df) <= 1:
|
172 |
result_str += f'''<div><p class="unavailable">This app is temporarily unavailable</p></div>'''
|
173 |
+
status_code = 500
|
174 |
else:
|
175 |
last_update_utc = datetime.strptime(redis_client.get('NEWSFETCHTIME'), '%Y-%m-%d %H:%M:%S.%f')
|
176 |
last_update_mins = int(np.ceil((datetime.now() - last_update_utc).seconds / 60))
|
|
|
236 |
'''
|
237 |
|
238 |
result_str += '</form></div>'
|
239 |
+
return render_template("index.html", body=result_str), status_code
|
240 |
|
241 |
|
242 |
if __name__ == "__main__":
|