Spaces:
Running
Running
Commit
·
c7635ba
1
Parent(s):
82bb700
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import kangas as kg
|
|
8 |
import subprocess
|
9 |
|
10 |
proj_dir = Path(__file__).parent
|
11 |
-
filename = proj_dir / "
|
12 |
|
13 |
_config.set_option("server.headless", True)
|
14 |
_config.set_option("server.port", 7840)
|
@@ -74,8 +74,14 @@ def image_proxy(path=None):
|
|
74 |
return response
|
75 |
|
76 |
@application.route('/')
|
77 |
-
def
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
if __name__ == "__main__":
|
81 |
kg.launch(host=ip_address, port=7640, debug="DEBUG")
|
|
|
8 |
import subprocess
|
9 |
|
10 |
proj_dir = Path(__file__).parent
|
11 |
+
filename = proj_dir / "streamlitapp.py"
|
12 |
|
13 |
_config.set_option("server.headless", True)
|
14 |
_config.set_option("server.port", 7840)
|
|
|
74 |
return response
|
75 |
|
76 |
@application.route('/')
|
77 |
+
def streamlit():
|
78 |
+
streamlit.web.bootstrap.run(str(filename), "", args, "")
|
79 |
+
resp = requests.get(f'http://{ip_address}:7840/')
|
80 |
+
excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
|
81 |
+
headers = [(name, value) for (name, value) in resp.raw.headers.items() if name.lower() not in excluded_headers]
|
82 |
+
response = Response(resp.content, resp.status_code, headers)
|
83 |
+
application.logger.info(response)
|
84 |
+
return response
|
85 |
|
86 |
if __name__ == "__main__":
|
87 |
kg.launch(host=ip_address, port=7640, debug="DEBUG")
|