Spaces:
Runtime error
Runtime error
model testing
Browse files- accident.jpg +0 -0
- app.py +14 -4
- model.pkl +3 -0
- model.pkl:Zone.Identifier +3 -0
- non-accident.jpg +0 -0
- requirements.txt +3 -0
accident.jpg
ADDED
|
app.py
CHANGED
|
@@ -1,7 +1,17 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
-
|
| 6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastbook import *
|
| 3 |
+
from fastai.vision.widgets import *
|
| 4 |
+
import timm
|
| 5 |
+
import gradio as gr
|
| 6 |
+
categories = ('accident' , 'non-accident')
|
| 7 |
+
learn = load_learner('/content/model.pkl')
|
| 8 |
+
def classify(img):
|
| 9 |
+
img = img.resize(224)
|
| 10 |
+
categories,index,probs = learn.predict(img)
|
| 11 |
+
return dict(zip(categories , map(float,probs)))
|
| 12 |
+
img = gr.inputs.Image(shape=(224))
|
| 13 |
+
label = gr.outputs.Label()
|
| 14 |
+
example = ['/content/accident.jpg' , '/content/non-accident.jpg']
|
| 15 |
|
| 16 |
+
iface = gr.Interface(fn=classify, inputs="image", outputs="label" , examples= example)
|
|
|
|
|
|
|
|
|
|
| 17 |
iface.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:557466ddba2789884d21bfc2fddf96eb3ad193c2448e2a406ec0743fe640a176
|
| 3 |
+
size 114623829
|
model.pkl:Zone.Identifier
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[ZoneTransfer]
|
| 2 |
+
ZoneId=3
|
| 3 |
+
HostUrl=about:internet
|
non-accident.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-Uqq fastbook
|
| 2 |
+
fastai
|
| 3 |
+
timm
|