Spaces:
Sleeping
Sleeping
Commit ·
c7dd0af
1
Parent(s): 3f75a1d
Fix model loading
Browse files
app.py
CHANGED
|
@@ -2,6 +2,15 @@ import gradio as gr
|
|
| 2 |
from fastai.vision.all import *
|
| 3 |
|
| 4 |
# Load model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
learn = cnn_learner(dls, resnet18)
|
| 6 |
learn.load("model.pth")
|
| 7 |
|
|
|
|
| 2 |
from fastai.vision.all import *
|
| 3 |
|
| 4 |
# Load model
|
| 5 |
+
classes = ['SUV', 'bus', 'cabriolet', 'crossover', 'hatchback', 'limousine', 'pickup', 'sedan', 'sports', 'truck', 'van']
|
| 6 |
+
|
| 7 |
+
dls = ImageDataLoaders.from_folder(
|
| 8 |
+
Path("."), # dummy path
|
| 9 |
+
valid_pct=0.0,
|
| 10 |
+
item_tfms=Resize(224)
|
| 11 |
+
)
|
| 12 |
+
dls.vocab = classes
|
| 13 |
+
|
| 14 |
learn = cnn_learner(dls, resnet18)
|
| 15 |
learn.load("model.pth")
|
| 16 |
|