Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ ENV PORT=80 \
ELASTICSEARCH_URL=elasticsearch:9200 \
ELASTICSEARCH_INDEX=images \
ELASTICSEARCH_DOC_TYPE=images \
ALL_ORIENTATIONS=true
ALL_ORIENTATIONS=true \
DISTANCE_CUTOFF=0.45

CMD gunicorn \
-t 60 \
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export PORT ?= 8888
export ELASTICSEARCH_URL ?= elasticsearch:9200
export ELASTICSEARCH_INDEX ?= images
export ELASTICSEARCH_DOC_TYPE ?= images
export DISTANCE_CUTOFF ?= 0.45

all: run

Expand All @@ -21,6 +22,7 @@ run: build
-e ELASTICSEARCH_URL \
-e ELASTICSEARCH_INDEX \
-e ELASTICSEARCH_DOC_TYPE \
-e DISTANCE_CUTOFF \
-p $(PORT):$(PORT) \
-it $(DOCKER_TAG)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ spec:
env:
- name: WORKER_COUNT
value: "4"
- name: DISTANCE_CUTOFF
value: 0.45
- name: ELASTICSEARCH_URL
valueFrom:
secretKeyRef:
Expand Down
2 changes: 2 additions & 0 deletions rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
env:
- name: WORKER_COUNT
value: "4"
- name: DISTANCE_CUTOFF
value: 0.45
- name: ELASTICSEARCH_URL
valueFrom:
secretKeyRef:
Expand Down
3 changes: 2 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
es_index = os.environ['ELASTICSEARCH_INDEX']
es_doc_type = os.environ['ELASTICSEARCH_DOC_TYPE']
all_orientations = os.environ['ALL_ORIENTATIONS']
distance_cutoff_param = float(os.environ.get('DISTANCE_CUTOFF', 0.45))

app = Flask(__name__)
es = Elasticsearch([es_url], verify_certs=True, timeout=60, max_retries=10, retry_on_timeout=True)
ses = SignatureES(es, index=es_index, doc_type=es_doc_type)
ses = SignatureES(es, index=es_index, doc_type=es_doc_type, distance_cutoff=distance_cutoff_param)
gis = ImageSignature()

# Try to create the index and ignore IndexAlreadyExistsException
Expand Down