File size: 486 Bytes
af138d9
 
 
 
 
 
 
 
 
 
 
17bf7ad
 
af138d9
17bf7ad
 
 
 
 
 
 
af138d9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from PIL import Image
from fastai.vision.all import *

def predict_image(image):
    learner = learner_load('export.pkl')
    img = PILImage.create(image)
    pred = learner.predict(img)
    return pred[0]


image_input = gr.Image(type="pil")
output = gr.Text()

gr.Interface(
    fn=predict_image,
    inputs=image_input,
    outputs=output,
    title="Cat or Dog Classifier",
    description="Upload an image to classify whether it's a cat or a dog."
).launch()