Skip to content
Merged
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
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM python:3.10-slim AS builder

WORKDIR /install
COPY requirements.txt ./
RUN pip install --upgrade pip && \
pip install --no-cache-dir --prefix=/install/packages -r requirements.txt

FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app ./app

ENV PYTHONPATH=/app

COPY --from=builder /install/packages /usr/local/
COPY ./app /app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import FastAPI
from routes import skt_classify
from app.routes import skt_classify

app = FastAPI(title="SKT KoBERT Text Classification API with URL Extraction")

Expand Down
2 changes: 1 addition & 1 deletion app/models/kobert_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# 문장 임베딩 생성 함수
#테스트용 문장

#ㄱㄱ
def get_sentence_embedding(text: str):
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
Expand Down
3 changes: 1 addition & 2 deletions app/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import uvicorn

if __name__ == "__main__":
# 서버 구동 이후 디버깅을 위해 reload=True 옵션을 추가한다
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=True)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ transformers
numpy
sentencepiece
protobuf
scikit-learn
scikit-learn
sentence-transformers