arvindsharmaphd7 commited on
Commit
0810958
1 Parent(s): 2e6fc71

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +29 -0
  2. export1.pkl +3 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """app.py
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1i0qWUKiGkonO3aH5VydlVQYpBKnAbixw
8
+ """
9
+
10
+ import gradio as gr
11
+ from fastai.vision.all import *
12
+ import skimage
13
+
14
+ learn = load_learner('export.pkl')
15
+
16
+ labels = learn.dls.vocab
17
+ def predict(img):
18
+ img = PILImage.create(img)
19
+ pred,pred_idx,probs = learn.predict(img)
20
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
21
+
22
+ title = "Pet Breed Classifier"
23
+ description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
24
+ article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
25
+ examples = ['siamese.jpg']
26
+ interpretation='default'
27
+ enable_queue=True
28
+
29
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
export1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8102716ac6466a5d1d86a47dee8f03269603691efc87624a9baca117db21e362
3
+ size 47128207