import gradio as gr | |
import fastai as fastai | |
from fastcore.all import * | |
from fastai.vision.all import * | |
learn = load_learner('model.pkl') | |
categories=('active','drowsy') | |
def classify(image): | |
pred,idx,probs=learn.predict(image) | |
return dict(zip(categories,map(float,probs))) | |
inter=gr.Interface(fn=classify, inputs='image', outputs='text') | |
inter.launch() |