File size: 357 Bytes
6f67759
492c6e8
 
6f67759
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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()