Skip to content

Commit d08db66

Browse files
authored
Merge branch 'dev' into Tag-APi
2 parents 2dad65e + 6554eb9 commit d08db66

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
FROM python:alpine3.6
1+
FROM python:3.7
22
MAINTAINER Wannaphong Phatthiyaphaibun <[email protected]>
3-
WORKDIR /usr/src/app
3+
WORKDIR /app
44
EXPOSE 8000
55

66
COPY requirements.txt ./
7-
RUN pip install --no-cache-dir -r requirements.txt
7+
RUN apt-get update
8+
RUN apt-get install -y python3-dev
9+
RUN pip install -r requirements.txt
810

911
COPY . .
1012

11-
CMD ["python", "app.py"]
13+
CMD ["uvicorn", "main:app"]

docker-compose.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: "3"
2+
services:
3+
api:
4+
build: .
5+
volumes:
6+
- .:/usr/src/app
7+
ports:
8+
- "8000:8000"

main.py

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from fastapi import Depends, FastAPI, Header, HTTPException
33
from fastapi.middleware.cors import CORSMiddleware
44
from routers import tag, tokenize, word_vector
5+
import uvicorn
56
import pythainlp
67

78
DESC_TEXT = "Pythainlp API"
@@ -30,3 +31,7 @@ def index():
3031
app.include_router(tokenize.router, prefix="/tokenize", tags=["Tokenize"])
3132
app.include_router(word_vector.router,
3233
prefix="/word-vector", tags=["Word Vector"])
34+
35+
36+
if __name__ == "__main__":
37+
uvicorn.run(app, host="0.0.0.0", port=8000)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fastapi
2-
pythainlp
2+
pythainlp==2.1.4
33
uvicorn
44
pytest
55
gensim

routers/tokenize.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
from fastapi import APIRouter
23
from pythainlp import tokenize
34
from enum import Enum

0 commit comments

Comments
 (0)