Spaces:
Running
Running
file path errors
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
-
import os
|
4 |
# Load a pre-trained image classification model
|
5 |
root = os.path.dirname(__file__)
|
6 |
|
@@ -11,7 +11,7 @@ def get_label(fname):
|
|
11 |
# print(cls)
|
12 |
return name(cls)
|
13 |
|
14 |
-
learn = load_learner(
|
15 |
|
16 |
|
17 |
# Function to make predictions from an image
|
@@ -22,8 +22,7 @@ def classify_image(image):
|
|
22 |
return name[0]
|
23 |
|
24 |
# Sample images for user to choose from
|
25 |
-
sample_images = [
|
26 |
-
os.path.join(root, sample_images, "DodgeMagnumWagon2008.jpg")]
|
27 |
|
28 |
iface = gr.Interface(
|
29 |
fn=classify_image,
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
+
# import os
|
4 |
# Load a pre-trained image classification model
|
5 |
root = os.path.dirname(__file__)
|
6 |
|
|
|
11 |
# print(cls)
|
12 |
return name(cls)
|
13 |
|
14 |
+
learn = load_learner("./models/model.pkl")
|
15 |
|
16 |
|
17 |
# Function to make predictions from an image
|
|
|
22 |
return name[0]
|
23 |
|
24 |
# Sample images for user to choose from
|
25 |
+
sample_images = ["./sample_images/AcuraTLType-S2008.jpg", "./sample_images/AudiR8Coupe2012.jpg","./sample_images/DodgeMagnumWagon2008.jpg"]
|
|
|
26 |
|
27 |
iface = gr.Interface(
|
28 |
fn=classify_image,
|