Spaces:
Build error
Build error
Amr Elsayeh commited on
Commit ·
71d93e7
1
Parent(s): db6499e
Adding Files
Browse files- README.md +4 -4
- Rifles.jpg +0 -0
- Shotguns.jpg +0 -0
- app.py +22 -0
- model.pkl +3 -0
- pistol.jpg +0 -0
- requirements.txt +2 -0
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title: Gun
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.12.0
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Gun Types
|
| 3 |
+
emoji: 🌍
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.12.0
|
| 8 |
app_file: app.py
|
Rifles.jpg
ADDED
|
Shotguns.jpg
ADDED
|
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def is_pistol(x): return x[0].isupper()
|
| 5 |
+
|
| 6 |
+
# Cell
|
| 7 |
+
learn = load_learner('model.pkl')
|
| 8 |
+
|
| 9 |
+
# Cell
|
| 10 |
+
categories = ('pistol','Rifles','Shotguns')
|
| 11 |
+
|
| 12 |
+
def classify_image(img):
|
| 13 |
+
pred,idx,probs = learn.predict(img)
|
| 14 |
+
return dict(zip(categories, map(float,probs)))
|
| 15 |
+
|
| 16 |
+
# Cell
|
| 17 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 18 |
+
label = gr.outputs.Label()
|
| 19 |
+
examples = ['pistol.jpg','Rifles.jpg','Shotgun.jpg']
|
| 20 |
+
|
| 21 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 22 |
+
intf.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:871e865c723c14d1e0a6d03d2aadcb30bbbf387f7912ba56435f0e122cb208d2
|
| 3 |
+
size 102884515
|
pistol.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
|