Spaces:
Runtime error
Runtime error
initial upload
Browse files- app.py +22 -0
- corgi puppy - test.jfif +0 -0
- corgi puppy - test.jfifZone.Identifier +4 -0
- corgi puppy.jfif +0 -0
- corgi puppy.jfifZone.Identifier +4 -0
- golden retriever puppy - test.jfif +0 -0
- golden retriever puppy - test.jfifZone.Identifier +4 -0
- golden retriever puppy.jfif +0 -0
- golden retriever puppy.jfifZone.Identifier +4 -0
- husky puppy - test.jfif +0 -0
- husky puppy - test.jfifZone.Identifier +4 -0
- husky puppy.jfif +0 -0
- husky puppy.jfifZone.Identifier +4 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner("puppy.pkl")
|
6 |
+
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
|
9 |
+
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred,pred_idx,probs = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
title = "Puppy Breed Classifier"
|
15 |
+
description = "A puppy breed classifier trained on a custom dataset from DDG images with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
16 |
+
image = gr.Image(height=215, width=215)
|
17 |
+
label = gr.Label()
|
18 |
+
examples = [['corgi puppy.jfif'], ['golden retriever.jfif'], ['husky bear.jfif']]
|
19 |
+
|
20 |
+
|
21 |
+
intf = gr.Interface(fn=predict, inputs=image, outputs=label, title=title, description=description,examples=examples)
|
22 |
+
intf.launch(inline=False)
|
corgi puppy - test.jfif
ADDED
Binary file (6.11 kB). View file
|
|
corgi puppy - test.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSyG6CH3QXq3KIypwikLfpoNdWWM1-bF6Ipnw&s
|
corgi puppy.jfif
ADDED
Binary file (7.01 kB). View file
|
|
corgi puppy.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://www.google.com/
|
golden retriever puppy - test.jfif
ADDED
Binary file (6.24 kB). View file
|
|
golden retriever puppy - test.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://www.google.com/
|
golden retriever puppy.jfif
ADDED
Binary file (14.5 kB). View file
|
|
golden retriever puppy.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://www.google.com/
|
husky puppy - test.jfif
ADDED
Binary file (9.48 kB). View file
|
|
husky puppy - test.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRXw3xzjyUdC9GOFS401HsSb9IE4Pwh66hSxg&s
|
husky puppy.jfif
ADDED
Binary file (9.3 kB). View file
|
|
husky puppy.jfifZone.Identifier
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[ZoneTransfer]
|
2 |
+
ZoneId=3
|
3 |
+
ReferrerUrl=https://www.google.com/
|
4 |
+
HostUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQeVYbv_a3fPh6bwz6j4wsmO3gW_X2K-CNxQg&s
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|