neilkazimierzsheridan commited on
Commit
2d6cd88
·
1 Parent(s): 63e251b

add new files

Browse files
Files changed (3) hide show
  1. app.py +15 -4
  2. export_pets.pkl +3 -0
  3. requirements.txt +2 -0
app.py CHANGED
@@ -1,7 +1,18 @@
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello there " + name + "!!"
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import skimage
3
+
4
  import gradio as gr
5
 
6
+ labels = learn.dls.vocab
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred,pred_idx,probs = learn.predict(img)
10
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
+
12
+ learn = load_learner('export_pets.pkl') #this is a kinda dog detector it seems
13
 
14
+ gr.Interface(fn=predict,
15
+ title="Pet Breed Classifier",
16
+ description="Pet breed classifier using Oxford Pets Database. Test for Gradio and HuggingFace",
17
+ inputs=gr.Image(width=512, height=512), #this is the proper syntax for images not the (shape=(xxx,xxx))
18
+ outputs=gr.Label(num_top_classes=3)).launch(share=True)
export_pets.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59a5c70cb5310ce479dc6cbe8b1df64e680b5574af50ea2b6bb0867a1cfd727e
3
+ size 103052844
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image