diff --git a/.DS_Store b/.DS_Store index aa24c4a..ce70799 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/main.py b/main.py index f233a4a..91547d5 100644 --- a/main.py +++ b/main.py @@ -1,26 +1,38 @@ #Modified by smartbuilds.io #Date: 27.09.20 -#Desc: This scrtipt script.. +#Desc: This web application serves a motion JPEG stream # main.py - # import the necessary packages -from flask import Flask, render_template, Response +from flask import Flask, render_template, Response, request from camera import VideoCamera +import time +import threading +import os + +pi_camera = VideoCamera(flip=False) # flip pi camera if upside down. + +# App Globals (do not edit) app = Flask(__name__) + @app.route('/') def index(): - # rendering webpage - return render_template('index.html') + return render_template('index.html') #you can customze index.html here + def gen(camera): + #get camera frame while True: - #get camera frame frame = camera.get_frame() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n') + @app.route('/video_feed') def video_feed(): - return Response(gen(VideoCamera()), + return Response(gen(pi_camera), mimetype='multipart/x-mixed-replace; boundary=frame') + if __name__ == '__main__': - # defining server ip address and port - app.run(host='0.0.0.0',port='5000', debug=False) + + app.run(host='0.0.0.0', debug=False) + + + diff --git a/templates/index.html b/templates/index.html index fa5fb62..2c7aaf3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -149,19 +149,6 @@ body { - -
@@ -182,6 +169,7 @@ button.onclick = function() { div.style.display = 'block'; } }; +