Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
categories = ('Dog', 'Cat')
|
5 |
+
learn = load_learner('model1.pk1')
|
6 |
+
def classify_image(img):
|
7 |
+
pred , idx , probs = learn.predict(img)
|
8 |
+
return dict(zip(categories , map(float,probs)))
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
image = gr.inputs.image(shape=(192 ,192))
|
13 |
+
label = gr.outputs.Label()
|
14 |
+
examples = ['dog.jpg', 'cat.jpg', 'dumo.jpg']
|
15 |
+
demo = gr.Interface(fn=classify_image, inputs=image, outputs= label)
|
16 |
+
demo.launch(inline = False)
|
17 |
+
|
18 |
+
m = learn.model
|
19 |
+
ps = list(m.parameters())
|
20 |
+
|
21 |
+
ps[1]
|