Spaces:
Runtime error
Runtime error
resolving errors
Browse files- app.py +3 -5
- flagged/img/tmpoxic_h49.jpg +0 -0
- flagged/log.csv +2 -0
- flagged/output/tmp36k9kjmf.json +1 -0
app.py
CHANGED
|
@@ -2,15 +2,13 @@ import gradio as gr
|
|
| 2 |
from fastbook import *
|
| 3 |
from fastai.vision.widgets import *
|
| 4 |
import timm
|
| 5 |
-
|
| 6 |
-
categories = ('accident' , 'non-accident')
|
| 7 |
learn = load_learner('model.pkl')
|
| 8 |
def classify(img):
|
| 9 |
-
|
| 10 |
-
return dict(zip(categories , map(float,probs)))
|
| 11 |
img = gr.inputs.Image(shape=(224))
|
| 12 |
label = gr.outputs.Label()
|
| 13 |
example = ['accident.jpg' , 'non-accident.jpg']
|
| 14 |
-
|
| 15 |
iface = gr.Interface(fn=classify, inputs="image", outputs="label" , examples= example)
|
| 16 |
iface.launch()
|
|
|
|
| 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()
|
flagged/img/tmpoxic_h49.jpg
ADDED
|
flagged/log.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
img,output,flag,username,timestamp
|
| 2 |
+
/home/manoj/accident_model/accident_detection/flagged/img/tmpoxic_h49.jpg,/home/manoj/accident_model/accident_detection/flagged/output/tmp36k9kjmf.json,,,2023-05-03 07:37:51.154637
|
flagged/output/tmp36k9kjmf.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"label": "A", "confidences": [{"label": "accident", "confidence": 0.9861869812011719}, {"label": "non-accident", "confidence": 0.013813060708343983}]}
|