Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index():
- return render_template('index.html')
- def get_frame():
- from PIL import ImageGrab
- import pyscreenshot as ImageGrab
- import ImageGrab
- import io
- img = ImageGrab.grab()
- output = io.BytesIO()
- img.save(output, format='PNG')
- return (output.getvalue())
- def index():
- return render_template('index.html')
- def gen():
- while True:
- frame = get_frame()
- yield (b'--framern'
- b'Content-Type: image/jpegrnrn' + frame + b'rnrn')
- app = Flask(__name__)
- def getData():
- import socket
- s = socket.socket()
- s.bind(('0.0.0.0', 65320))
- s.listen(1)
- s.accept()
- while True:
- print s.recv(1024)
- import thread
- t1 = thread.start_new_thread(getData, ())
- @app.route('/')
- @app.route('/video_feed')
- def video_feed():
- return Response(gen(),
- mimetype='multipart/x-mixed-replace; boundary=frame')
- app.run(host='localhost', debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement