File size: 831 Bytes
cc4792d
 
 
e732d48
 
 
 
 
 
 
 
 
 
 
 
 
cc4792d
 
 
 
 
 
 
 
 
 
 
e732d48
 
 
7360946
c48fac5
7360946
 
 
7d0ccb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests
from flask import Flask
import socket
from pathlib import Path
import streamlit.web.bootstrap
from streamlit import config as _config
import kangas as kg

proj_dir = Path(__file__).parent
filename = proj_dir / "app.py"

_config.set_option("server.headless", True)
_config.set_option("server.port", 7840)
args = []

# streamlit.cli.main_run(filename, args)

app = Flask(__name__)
hostname = socket.gethostname()
ip_address = socket.gethostbyname(hostname)

@app.route('/kangas')
def kangas():
    return requests.get(f"http://{ip_address}:7640").content

@app.route('/')
def streamlit():
    return requests.get(f"http://{ip_address}:7840").content

if __name__ == '__main__':
    streamlit.web.bootstrap.run(str(filename), "", args, "")
    kg.launch(
        host=ip_address,
        port=7640
    )
    app.run()