Add TensorBoard server to Flask endpoint
See original GitHub issueI have a Flask App and a Tensorboad server. Is there a way by which I can map the Tensorboard server to one of the endpoints of Flask so that as soon as I hit that endpoint it triggers the Tensorboard server?
Flask application
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/hello-world', methods=['GET', 'POST'])
def say_hello():
return jsonify({'result': 'Hello world'})
if __name__ == "__main__":
app.run(host=host, port=5000)
Tensorboard server code:
from tensorboard.program import TensorBoard, setup_environment
def tensorboard_main(host, port, logdir):
configuration = list([""])
configuration.extend(["--host", host])
configuration.extend(["--port", port])
configuration.extend(["--logdir", logdir])
tensorboard = TensorBoard()
tensorboard.configure(configuration)
tensorboard.main()
if __name__ == "__main__":
host = "0.0.0.0"
port = "7070"
logdir = '/tmp/logdir'
tensorboard_main(host, port, logdir)
I tried creating an endpoint in Flask app and then added tensorboard_main(host, port, logdir) in the hope that if I hit the endpoint then the server will start but I got no luck.
I had posted this issue on StackOverflow but didn’t get a valid reply hence posting it here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Add Tensorboard server to Flask endpoint - Stack Overflow
I found out that to integrate a TensorBoard server into a larger Flask app, the best way would be to compose the applications...
Read more >Developers - Add TensorBoard server to Flask endpoint -
I have a Flask App and a Tensorboad server. Is there a way by which I can map the Tensorboard server to one...
Read more >Deploying Keras models using TensorFlow Serving and Flask
Learn how to use Keras to download InceptionV3 image classifier CNN and deploy it using TensorFlow Serving. Manage multiple servers, their ...
Read more >Using TensorFlow with Flask and React | by Tarric Sookdeo
TensorFlow is a popular machine learning framework maintained by the Google Brain Team. TensorFlow gives you access to high-level functions to train, analyze, ......
Read more >Deploy ML tensorflow model using Flask(backend+frontend)
a. Create an html file named predict. · hasan-haider/Deploy-ML-tensorflow-model-using-Flask · b. Add route function for predict page · c. Modify ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Could you post the full code that you’re using? The code that I posted works for me with TensorBoard 2.2.2 and Flask 1.1.2:
I also appreciate this starter code, it’s fantastic for what I need. Is there any way to get this to work with flask’s reloader? I tried adding ‘use_reloader=True’ to the run_simple but then it complains about signal handlers being installed outside the main thread. I can’t find anything that indicates that tensorboard has similar reload facilities on file change detection?