Spaces:
Sleeping
Sleeping
File size: 685 Bytes
95c07de 0972752 95c07de 0972752 a37bcd0 95c07de 0972752 95c07de |
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 |
from fastai.vision.all import load_learner
import gradio as gr
from PIL import Image
# Define the missing function
def is_cat(x):
return x[0].isupper()
# Load the trained model
model = load_learner('model.pkl')
# Define a function to make predictions
def predict(image):
pred, _, probs = model.predict(image)
return f"Prediction: {pred} (Confidence: {probs.max():.2f})"
# Create the Gradio web interface
interface = gr.Interface(
fn=predict,
inputs=gr.inputs.Image(type="pil"),
outputs="text",
title="Cat vs Dog Classifier",
description="Upload an image of a cat or dog and let the model classify it!"
)
# Launch the Gradio app
interface.launch()
|