garvitcpp commited on
Commit
5d4f30e
·
verified ·
1 Parent(s): 916c7bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -18
app.py CHANGED
@@ -5,27 +5,20 @@ import logging
5
  from textblob import TextBlob # Ensure this library is installed
6
  import http.server
7
  import threading
8
-
9
 
10
  # Set up logging
11
  logging.basicConfig(level=logging.DEBUG)
12
 
13
- class HealthCheck(http.server.BaseHTTPRequestHandler):
14
- def do_GET(self):
15
- if self.path == '/health':
16
- self.send_response(200)
17
- self.send_header('Content-type', 'text/plain')
18
- self.end_headers()
19
- self.wfile.write(b"OK")
20
-
21
- def do_HEAD(self):
22
- if self.path == '/health':
23
- self.send_response(200)
24
- self.send_header('Content-type', 'text/plain')
25
- self.end_headers()
26
 
27
  def main():
28
- threading.Thread(target=lambda: http.server.HTTPServer(('', 8080), HealthCheck).serve_forever(), daemon=True).start()
29
  # Streamlit app configuration
30
  st.set_page_config(
31
  page_title="SumItUp | Document Summarizer",
@@ -36,11 +29,12 @@ def main():
36
  st.title("✍️ SumItUp")
37
  st.subheader("Intelligent Document Summarization Made Easy")
38
 
39
- if 'health' in st.experimental_get_query_params():
40
- st.write("OK")
41
- st.stop()
42
  return
43
 
 
 
 
44
  # Sidebar for configuration
45
  st.sidebar.header("Summarization Settings")
46
  summary_length = st.sidebar.slider(
 
5
  from textblob import TextBlob # Ensure this library is installed
6
  import http.server
7
  import threading
8
+ import json
9
 
10
  # Set up logging
11
  logging.basicConfig(level=logging.DEBUG)
12
 
13
+ def health_check():
14
+ """Simple health check endpoint that returns JSON"""
15
+ if 'health' in st.experimental_get_query_params():
16
+ st.write(json.dumps({"status": "OK"}))
17
+ st.stop()
18
+ return True
19
+ return False
 
 
 
 
 
 
20
 
21
  def main():
 
22
  # Streamlit app configuration
23
  st.set_page_config(
24
  page_title="SumItUp | Document Summarizer",
 
29
  st.title("✍️ SumItUp")
30
  st.subheader("Intelligent Document Summarization Made Easy")
31
 
32
+ if health_check():
 
 
33
  return
34
 
35
+ st.title("✍️ SumItUp")
36
+ st.subheader("Intelligent Document Summarization Made Easy")
37
+
38
  # Sidebar for configuration
39
  st.sidebar.header("Summarization Settings")
40
  summary_length = st.sidebar.slider(