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()