This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from fastapi import File, UploadFile, HTTPException | |
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY | |
@app.post("/predict_csv") | |
def predict_csv(csv_file: UploadFile = File(...), model: Model = Depends(get_model)): | |
try: | |
df = pd.read_csv(csv_file.file).astype(float) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:19.10 | |
COPY ./api /api/api | |
COPY requirements.txt /requirements.txt | |
RUN apt-get update \ | |
&& apt-get install python3-dev python3-pip -y \ | |
&& pip3 install -r requirements.txt | |
ENV PYTHONPATH=/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
fastapi-ml-quickstart: | |
build: . | |
ports: | |
- 8000:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This GitHub action describes the continuous integration workflow for pull requests to master. | |
name: ci | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
fastapi-ml-quickstart: | |
build: . | |
ports: | |
- 8000:8000 | |
entrypoint: ["pytest"] |
OlderNewer