openai-02 / app.py
pablitus's picture
Fix
5cbb8b5
raw
history blame contribute delete
380 Bytes
import gradio as gr
from fastai.vision.all import *
learn_inf = load_learner('export.pkl')
def greet(image):
pred,pred_idx,probs = learn_inf.predict(image)
return f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
iface = gr.Interface(fn=greet, inputs=image, outputs=label)
iface.launch()