File size: 376 Bytes
98d9515
 
 
 
 
 
 
 
c972bdd
98d9515
 
 
510708c
98d9515
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
import os
from fastai.vision.all import load_learner


model = load_learner("model.pkl")

def predict(img):
    prediction, idx, confidence = model.predict(img)
    return prediction


image = gr.inputs.Image(shape=(200, 200), source="webcam")
label = gr.outputs.Label()

interface = gr.Interface(fn=predict, inputs=image, outputs=label)
interface.launch()