whywynn commited on
Commit
21ab601
1 Parent(s): 7110456

initial upload

Browse files
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.jfifZone.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.jfifZone.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.jfifZone.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.jfifZone.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.jfifZone.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.jfifZone.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