Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
learn = load_learner('bearmodel.pkl') | |
def predict(img): | |
img = PILImage.create(img) | |
pred,pred_idx,probs = learn.predict(img) | |
return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
image = gr.Image(height=192, width=192) | |
label = gr.Label() | |
intf = gr.Interface(fn=predict, inputs=image, outputs=label) | |
intf.launch(inline=False) | |
#def greet(name): | |
# return "Hello " + name + "!!" | |
#demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
#demo.launch() |