Spaces:
Runtime error
Runtime error
new app
Browse files- .gitattributes +1 -0
- app.py +16 -4
- flagged/img/0.jpg +0 -0
- flagged/img/1.jpg +0 -0
- flagged/img/2.jpg +0 -0
- flagged/img/3.jpg +0 -0
- flagged/log.csv +5 -0
- model.pkl +3 -0
- model.pkl:Zone.Identifier +0 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
model.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def is_cat(x): return x[0].isUpper()
|
|
|
5 |
|
6 |
+
learn = load_learner('model.pkl')
|
7 |
+
|
8 |
+
categories = ('Dog', 'Cat')
|
9 |
+
|
10 |
+
def classify_image(img):
|
11 |
+
pred, idx, probs = learn.predict(img)
|
12 |
+
return dict(zip(categories, map(float, probs)))
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(192, 192))
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
examples = ['dog.jpg', 'cat.jpg']
|
17 |
+
|
18 |
+
intf = gr.Interface(fn=classify_image, inputs = image, outputs=label, examples=examples)
|
19 |
+
intf.launch(inline=False, share=True)
|
flagged/img/0.jpg
ADDED
flagged/img/1.jpg
ADDED
flagged/img/2.jpg
ADDED
flagged/img/3.jpg
ADDED
flagged/log.csv
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'img','output','flag','username','timestamp'
|
2 |
+
'img/0.jpg','{"Cat": 0.9831337928771973, "Dog": 0.016866201534867287}','','','2022-08-31 01:05:08.426331'
|
3 |
+
'img/1.jpg','{"Cat": 0.9831337928771973, "Dog": 0.016866201534867287}','','','2022-08-31 01:05:10.402508'
|
4 |
+
'img/2.jpg','{"Cat": 0.9831337928771973, "Dog": 0.016866201534867287}','','','2022-08-31 01:05:12.237047'
|
5 |
+
'img/3.jpg','{"Cat": 0.9831337928771973, "Dog": 0.016866201534867287}','','','2022-08-31 01:05:14.566388'
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6882a51a315a714cadc20a5f3e6c7e2afa7decf49f9f5ff2e0ba330df67e03a0
|
3 |
+
size 47061419
|
model.pkl:Zone.Identifier
ADDED
File without changes
|