Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, render_template, Response
- #Get your object here
- from camera import VideoCamera
- app = Flask(__name__)
- @app.route('/')
- def index():
- return render_template('index.html')
- def gen(camera):
- while True:
- frame = camera.get_frame()
- yield (b'--frame\r\n'
- b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')
- #<sourceIP>8080/video_feed URL for live video:
- @app.route('/video_feed')
- def video_feed():
- return Response(gen(VideoCamera()),
- mimetype='multipart/x-mixed-replace; boundary=frame')
- #Run the web server
- if __name__ == '__main__':
- app.run(host='0.0.0.0', port='8080', debug=True)
Add Comment
Please, Sign In to add comment