BirdOrForest / app.py
3v324v23's picture
Commit : 113
bb27838
raw
history blame
582 Bytes
import gradio as gr
from fastbook import *
learn = load_learner('BirdOrForest.pkl')
def predict_image(image):
img = PILImage.create(image)
pred, pred_idx, probs = learn.predict(img)
return pred
# Create a Gradio interface with updated input/output methods
iface = gr.Interface(
fn=predict_image,
inputs=gr.Image(), # Use gr.Image for input
outputs=gr.Label(), # Use gr.Label and gr.Number for output
examples=[
["Examples/1.jpg"],
["Examples/2.jpg"],
["Examples/3.jpg"],
["Examples/4.jpg"]
]
)
iface.launch()