Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
learn = load_learner('model.pkl')
|
4 |
+
categories=('active','drowsy')
|
5 |
+
def classify(image):
|
6 |
+
pred,idx,probs=learn.predict(image)
|
7 |
+
return dict(zip(categories,map(float,probs)))
|
8 |
+
inter=gr.Interface(fn=classify, inputs='image', outputs='text')
|
9 |
+
inter.launch()
|