Spaces:
Sleeping
Sleeping
app.py
Browse files- app.py +20 -4
- black.jpg +0 -0
- export.pkl +3 -0
- grizzly.jpg +0 -0
- teddy.jpg +0 -0
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
|
|
|
|
4 |
|
5 |
+
learn = load_learner("export.pkl" )
|
6 |
+
|
7 |
+
def classify_image(img):
|
8 |
+
pred, pred_idx, probs = learn.predict(img)
|
9 |
+
return pred
|
10 |
+
|
11 |
+
bear_types = 'grizzly' , 'black' , 'teddy'
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192 , 192))
|
14 |
+
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
|
17 |
+
examples = ["teddy.jpg" , "black.jpg" , "grizzly.jpg" ]
|
18 |
+
|
19 |
+
|
20 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
21 |
+
intf.launch(inline = False)
|
22 |
+
|
23 |
+
|
black.jpg
ADDED
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2236159e0668246e6a917afdc09c0f909d7e9760f8614a18e17e127827edfe59
|
3 |
+
size 46971745
|
grizzly.jpg
ADDED
teddy.jpg
ADDED