Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
learn = load_learner('made.pkl') | |
categories = ('Leão', 'Tigre') | |
# Function to classify the image using the selected model | |
def classify_image(img): | |
_, _, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
# Define input and output components | |
image = gr.Image() | |
label = gr.Label() | |
# Examples for testing | |
examples = ['Lion.jpg','Tiger.jpg','L2.jpg','T2.jpg','P1.jpg','T3.jpg','king.png'] | |
# Create Gradio Interface | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
# Launch the Gradio interface | |
intf.launch(inline=False) |