haha
Browse files- .gitattributes +1 -0
- app.py +20 -4
- black.jpg +0 -0
- export.pkl +3 -0
- grizzly.jpg +0 -0
- teddy.jpg +3 -0
.gitattributes
CHANGED
|
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
teddy.jpg filter=lfs diff=lfs merge=lfs -text
|
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 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import load_learner
|
| 3 |
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
learn = load_learner("export.pkl")
|
| 6 |
+
categories = ("black", "grizzly", "teddy")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def classify_image(img):
|
| 10 |
+
_, _, probs = learn.predict(img)
|
| 11 |
+
return dict(zip(categories, map(float, probs)))
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 15 |
+
label = gr.outputs.Label()
|
| 16 |
+
examples = ["black.jpg", "grizzly.jpg", "teddy.jpg"]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
iface = gr.Interface(
|
| 20 |
+
fn=classify_image, inputs="image", outputs="text", examples=examples
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
iface.launch()
|
black.jpg
ADDED
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1430401378b0e62976af41193f7158305a594e03c1aea1c804fc39ff879e2e3e
|
| 3 |
+
size 46965327
|
grizzly.jpg
ADDED
|
teddy.jpg
ADDED
|
Git LFS Details
|