Skip to content

Instantly share code, notes, and snippets.

View btphan95's full-sized avatar
🦄
focusing

Binh Phan btphan95

🦄
focusing
View GitHub Profile
@btphan95
btphan95 / app.py
Created May 9, 2020 23:00
a starlette app to host a deep learning model (that classifies dandelions vs. grass!)
#deep learning libraries
from fastai.vision import *
import torch
defaults.device = torch.device('cpu')
#web frameworks
from starlette.applications import Starlette
from starlette.responses import JSONResponse, HTMLResponse, RedirectResponse
import uvicorn
import aiohttp
@btphan95
btphan95 / Dockerfile
Created May 10, 2020 21:31
greenr Dockerfile
FROM python:3.6-slim-stretch
RUN apt update
RUN apt install -y python3-dev gcc
ADD requirements.txt requirements.txt
ADD export.pkl export.pkl
ADD app.py app.py
# Install required libraries
@btphan95
btphan95 / requirements.txt
Created May 14, 2020 20:43
requirements.txt [greenr-tutorial]
#required libraries
aiohttp==3.6.2
fastai==1.0.61
Pillow==7.1.1
python-multipart==0.0.5
starlette==0.13.3
torch==1.5.0
torchvision==0.6.0
uvicorn==0.11.3
@btphan95
btphan95 / ml_pipeline.py
Last active July 22, 2022 12:59
example ML pipeline on AirFlow
from datetime import timedelta
# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
# Operators; we need this to operate!
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
# These args will get passed on to each operator
# You can override them on a per-task basis during operator initialization
default_args = {
'owner': 'Binh Phan',