Skip to content

Instantly share code, notes, and snippets.

@minakhan01
Created February 3, 2018 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minakhan01/e1117a090f7f9fc9d620350004a26db7 to your computer and use it in GitHub Desktop.
Save minakhan01/e1117a090f7f9fc9d620350004a26db7 to your computer and use it in GitHub Desktop.
wifi_cam.py
import picamera
from time import sleep
import urllib2
import urllib
import requests
camera = picamera.PiCamera()
# query_args = { 'RPI':'Active' }
url = 'http://165.227.116:5000/predict'
# data = urllib.urlencode(query_args)
# request = urllib2.Request(url, data)
while True:
camera.capture('image.jpg')
files = {'image': open('image.jpg', 'rb')}
request = requests.post(url, files=files)
response = request.content
print response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment