Spaces:
Runtime error
Runtime error
TheBerbex
commited on
Commit
Β·
9e2cb0a
1
Parent(s):
8a76b75
Base version
Browse files- app.py +19 -0
- model.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('./model.pkl')
|
5 |
+
categories = ('Car in good condition','Damaged Car')
|
6 |
+
|
7 |
+
def is_car(x) : return x[0].isupper()
|
8 |
+
|
9 |
+
def image_classifier(img):
|
10 |
+
pred,index,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
# image = gr.inputs.Image(shape=(192,192))
|
14 |
+
image = gr.components.Image(shape=(192,192))
|
15 |
+
label = gr.components.Label()
|
16 |
+
examples = ['./car.jpeg','./crash.jpeg','./fcar.jpeg']
|
17 |
+
|
18 |
+
intf = gr.Interface(fn= image_classifier,inputs=image,outputs=label,examples=examples)
|
19 |
+
intf.launch()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:127d7e8cece70f90ec760f411318aa019f6e2d08ae846717bb5c1cdddf6e9868
|
3 |
+
size 46951577
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
torch==1.12.1
|