bearsprediction / app.py
whywynn's picture
Updated app.py to learn from bearmodel vs model
609686d
raw
history blame
534 Bytes
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()