daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest May 16th, 2018 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from flask import Flask, render_template, Response
  2. #Get your object here
  3. from camera import VideoCamera
  4.  
  5. app = Flask(__name__)
  6.  
  7. @app.route('/')
  8. def index():
  9.     return render_template('index.html')
  10.  
  11. def gen(camera):
  12.     while True:
  13.         frame = camera.get_frame()
  14.         yield (b'--frame\r\n'
  15.                b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')
  16. #<sourceIP>8080/video_feed  URL for live video:
  17. @app.route('/video_feed')
  18. def video_feed():
  19.     return Response(gen(VideoCamera()),
  20.                     mimetype='multipart/x-mixed-replace; boundary=frame')
  21. #Run the web server
  22. if __name__ == '__main__':
  23.     app.run(host='0.0.0.0', port='8080', debug=True)
RAW Paste Data
Top