File size: 532 Bytes
16357db 46352e6 16357db 46352e6 16357db 46352e6 3c01f22 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from fastai.vision.all import *
from fastbook import *
from fastai.vision.widgets import *
import gradio as gr
learn_inf = load_learner('export.pkl')
categories = ("maxi", "kairat")
def classify_image(img):
pred,idx,probs = learn_inf.predict(img)
return dict(zip(categories, map(float, probs)))
examples = ["maxi.jpg", "kairat.jpeg"]
intf = gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(192, 192)), outputs=gr.outputs.Label(), examples=examples)
intf.launch(inline=False,share=True)
|