CalebCometML commited on
Commit
e732d48
·
1 Parent(s): c44741e

Update router.py

Browse files
Files changed (1) hide show
  1. router.py +23 -1
router.py CHANGED
@@ -1,6 +1,24 @@
1
  import requests
2
  from flask import Flask
3
  import socket
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  app = Flask(__name__)
6
  hostname = socket.gethostname()
@@ -12,4 +30,8 @@ def kangas():
12
 
13
  @app.route('/')
14
  def streamlit():
15
- return requests.get(f"http://{ip_address}:7840").content
 
 
 
 
 
1
  import requests
2
  from flask import Flask
3
  import socket
4
+ from pathlib import Path
5
+ import streamlit.web.bootstrap
6
+ from streamlit import config as _config
7
+ import kangas as kg
8
+
9
+ proj_dir = Path(__file__).parent
10
+ filename = proj_dir / "app.py"
11
+
12
+ _config.set_option("server.headless", True)
13
+ _config.set_option("server.port", 7840)
14
+ args = []
15
+
16
+ # streamlit.cli.main_run(filename, args)
17
+ streamlit.web.bootstrap.run(str(filename), "", args, "")
18
+ kg.show(
19
+ host=ip_address,
20
+ port=7640
21
+ )
22
 
23
  app = Flask(__name__)
24
  hostname = socket.gethostname()
 
30
 
31
  @app.route('/')
32
  def streamlit():
33
+ return requests.get(f"http://{ip_address}:7840").content
34
+
35
+ if __name__ == '__main__':
36
+
37
+ app.run()