Spaces:
Build error
Build error
dev-seek commited on
Commit ·
799709b
1
Parent(s): 975229f
initial commit
Browse files- accident.jpg +0 -0
- app.py +14 -0
- model.pkl +3 -0
- non-accident.jpg +0 -0
- requirements.txt +3 -0
accident.jpg
ADDED
|
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastbook import *
|
| 3 |
+
from fastai.vision.widgets import *
|
| 4 |
+
import timm
|
| 5 |
+
categories = ['accident' , 'non-accident']
|
| 6 |
+
learn = load_learner('model.pkl')
|
| 7 |
+
def classify(img):
|
| 8 |
+
category,index,probs = learn.predict(img)
|
| 9 |
+
return (dict(zip(categories , map(float,probs))))
|
| 10 |
+
img = gr.inputs.Image(shape=(224))
|
| 11 |
+
label = gr.outputs.Label()
|
| 12 |
+
example = ['accident.jpg' , 'non-accident.jpg']
|
| 13 |
+
iface = gr.Interface(fn=classify, inputs="image", outputs="label" , examples= example)
|
| 14 |
+
iface.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d3804ac77daa0fb339dd721d58cd8e7fbe7d4e710cecbfe8697cac8d01c79b9
|
| 3 |
+
size 114640698
|
non-accident.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
-Uqq fastbook
|
| 3 |
+
timm
|