Skip to content

Commit

Permalink
adds flask-cors to modelhub dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhosny committed Aug 16, 2018
1 parent 2497125 commit 9b6d673
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions Dockerfile_modelhub
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM XXXXXXXX

# Install requirements
RUN pip install Flask==0.12.2 \
flask-cors==3.0.6 \
Redis==2.10.6 \
Pillow==5.1.0 \
SimpleITK==1.1.0 \
Expand Down
10 changes: 0 additions & 10 deletions framework/modelhubapi/restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
class ModelHubRESTAPI:

def __init__(self, model, contrib_src_dir):
print ("sikoooooo")
self.app = Flask(__name__)
CORS(self.app)
self.model = model
Expand Down Expand Up @@ -227,20 +226,11 @@ def _jsonify(self, content):
* All errors are returned as 400. Would be better to customize the error
code based on the actual error.
"""
# response = self._addCORS(jsonify(content))
response = jsonify(content)
if (type(content) is dict) and ("error" in content.keys()):
response.status_code = 400
return response

# def _addCORS(self, response):
# """
# Adds CORS rules to a given reponse. Should change to specific IP's later.
# """
# response.headers.add('Access-Control-Allow-Origin', '*')
# response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
# response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
# return response

def _samples(self, sample_name):
"""
Expand Down

0 comments on commit 9b6d673

Please sign in to comment.