Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,13 @@
|
|
4 |
from fastai.vision.all import *
|
5 |
import gradio as gr
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
labels = learn.dls.vocab
|
8 |
def predict(img):
|
9 |
img = PILImage.create(img)
|
|
|
4 |
from fastai.vision.all import *
|
5 |
import gradio as gr
|
6 |
|
7 |
+
path = untar_data(URLs.PETS)
|
8 |
+
dls = ImageDataLoaders.from_name_re(path, get_image_files(path/'images'), pat='(.+)_\d+.jpg', item_tfms=Resize(460), batch_tfms=aug_transforms(size=224, min_scale=0.75))
|
9 |
+
learn = vision_learner(dls, models.resnet50, metrics=accuracy)
|
10 |
+
learn.fine_tune(1)
|
11 |
+
learn.path = Path('.')
|
12 |
+
learn.export()
|
13 |
+
learn = load_learner('export.pkl')
|
14 |
labels = learn.dls.vocab
|
15 |
def predict(img):
|
16 |
img = PILImage.create(img)
|