Skip to content

Commit

Permalink
feat(nlp): add nlp project for eig (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelB authored Feb 13, 2019
1 parent 2fcb7f8 commit b4cb274
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker-compose.override.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ services:
volumes:
- ./packages/code-du-travail-data/:/app
- ./docker:/app/docker

nlp_api:
environment:
- FLASK_ENV=development
volumes:
- ./packages/code-du-travail-nlp/:/app
command: flask run --host=0.0.0.0
5 changes: 5 additions & 0 deletions docker-compose.override.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ services:
- setup.kibana.host=kibana:5601
- output.elasticsearch.hosts=elasticsearch:9200
- output.elasticsearch.enabled=true

nlp_api:
environment:
- FLASK_ENV=production
command: gunicorn -w 2 -b :5000 api.app:app
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ services:
context: ./packages/code-du-travail-data
dockerfile: ./Dockerfile

nlp_api:
ports:
- 5000:5000
build:
context: ./packages/code-du-travail-nlp
dockerfile: ./Dockerfile

volumes:
esdata:
driver: local
1 change: 1 addition & 0 deletions packages/code-du-travail-nlp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
15 changes: 15 additions & 0 deletions packages/code-du-travail-nlp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.7.2-stretch

ENV APP_DIR /app
ENV FLASK_APP ./api/app

WORKDIR ${APP_DIR}

COPY requirements.txt .

RUN python -m venv venv
RUN . venv/bin/activate
RUN pip install -r requirements.txt

COPY . .

Empty file.
15 changes: 15 additions & 0 deletions packages/code-du-travail-nlp/api/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from flask import Flask
from flask import request

app = Flask(__name__)

@app.route('/')
def hello():
return 'Hello there !'

@app.route('/api/words')
def words():
return 'query < %s >' % request.args.get('q', '')

if __name__ == "__main__":
app.run(debug=True)
2 changes: 2 additions & 0 deletions packages/code-du-travail-nlp/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==1.0.2
gunicorn==19.9.0

0 comments on commit b4cb274

Please sign in to comment.