Itsdockertest1 / model_loader.py
Ashrafb's picture
Create model_loader.py
4a4cd49 verified
raw
history blame contribute delete
497 Bytes
import urllib.request
from pathlib import Path
import os
from fastai.vision import load_learner
def download_model(url: str, filename: str):
urllib.request.urlretrieve(url, filename)
def load_model(model_path: str):
path = Path(".")
learn = load_learner(path, model_path)
return learn
if __name__ == "__main__":
MODEL_URL = "https://www.dropbox.com/s/04suaimdpru76h3/ArtLine_920.pkl?dl=1"
MODEL_FILENAME = "ArtLine_920.pkl"
download_model(MODEL_URL, MODEL_FILENAME)