Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.learner import load_learner | |
from fastai.vision.core import PILImage | |
learner = load_learner('export.pkl') | |
def predict_bear_type(img_path): | |
img = PILImage.create(img_path) | |
pred,pred_idx,probs = learner.predict(img) | |
return f"Prediction: {pred}; Probability: {probs[pred_idx]:.02f}" | |
iface = gr.Interface(fn=predict_bear_type, inputs="image", outputs="text") | |
iface.launch() | |