Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
few more tweaks
  • Loading branch information
ajagnanan committed Jul 25, 2017
commit 006d305dd105c10c7f53e2495d02a2e8cf036893
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.vscode
openface/images/**/*.jpg
openface/images/**/*.jpg
docker-compose\.yml
7 changes: 2 additions & 5 deletions docker-compose.yml → docker-compose.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ services:
opencv-api:
image: docker-opencv-api
ports:
- "9888:8888"
volumes:
- ./openface:/root/data
- ./webservice/web_server.py:/webservice/web_server.py
- ./webservice/openfaceUtils.py:/webservice/openfaceUtils.py
- "8888:8888"
environment:
- OCV_COUNTRY_CODE=us
- OCV_TOP_N=5
- OCV_MXNET_MODEL=squeezenet_v1.1 # squeezenet_v1.1 || vgg19
- OCV_DATA_PICKLE_URL=
- OCV_DATA_JSON_URL=
- GUNICORN_WORKERS=1
- GUNICORN_BIND=0.0.0.0:8888
- GUNICORN_TIMEOUT=240
Expand Down
2 changes: 1 addition & 1 deletion webservice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# openface vars
pickleLocation = '/root/data/data.pickle'
dataLocation = '/root/data/data.json'
pickleJsonLocation = '/root/data/data.json'

# create an alpr
alpr = Alpr(country_code, "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data")
Expand Down
8 changes: 7 additions & 1 deletion webservice/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@
logger.info('Pickle url found, proceeding with download...')
logger.info(pickleUrl)
urllib.urlretrieve(pickleUrl, config.pickleLocation)
jsonUrl = os.getenv('OCV_DATA_JSON_URL')
if jsonUrl:
logger.info('Pickle data url found, proceeding with download...')
logger.info(jsonUrl)
urllib.urlretrieve(jsonUrl, config.pickleJsonLocation)
except Exception as e:
logger.error("Unable to load pickle from url")
logger.exception(e)

# configure openface model
with open(config.pickleLocation) as f:
Expand All @@ -40,7 +46,7 @@
data_dict = {}

try:
with open(config.dataLocation) as f:
with open(config.pickleJsonLocation) as f:
data = json.load(f)

if 'profiles' in data:
Expand Down