File size: 832 Bytes
0c03a0b
990e9e8
b561682
6819837
b561682
0c03a0b
6819837
 
 
 
ce10a39
 
6819837
 
b561682
6819837
 
 
8d7e9fb
6819837
 
ce10a39
976b813
6819837
 
 
5a6049a
6819837
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
from fastai.vision.all import *
import os
# Load a pre-trained image classification model
learn = load_learner('./models/model.pth')

# Function to make predictions from an image
def classify_image(image):
    # Make a prediction
    # Decode the prediction and get the class name
    name = learn.predict(image)
    return name[0]

# Sample images for user to choose from
sample_images = ["./sample_images/AcuraTLType-S2008.jpg", "./sample_images/AudiR8Coupe2012.jpg", "./sample_images/DodgeMagnumWagon2008.jpg"]

iface = gr.Interface(
    fn=classify_image,
    inputs=gr.Image(label="Select an image", type="filepath"),
    outputs="text",
    live=True,
    title="Car image classifier",
    description="Upload a car image or select one of the examples below",
    examples=sample_images
)


iface.launch()