Ashutosh Rudraksh commited on
Commit
ee21661
·
1 Parent(s): 2264bd9
Files changed (5) hide show
  1. .DS_Store +0 -0
  2. __init__.py +1 -0
  3. app.py +27 -4
  4. dog.jpeg +0 -0
  5. duck.jpeg +0 -0
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = "0.0.1"
app.py CHANGED
@@ -1,7 +1,30 @@
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../cat_classifier_deployment.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_img']
5
+
6
+ # %% ../cat_classifier_deployment.ipynb 2
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ def is_cat(x): return x[0].isupper()
11
+
12
+
13
+ # %% ../cat_classifier_deployment.ipynb 4
14
+ learn = load_learner('model.pkl')
15
+
16
+ # %% ../cat_classifier_deployment.ipynb 6
17
+ categories = ('dog','Cat')
18
+
19
+ def classify_img(img):
20
+ pred,idx,probs = learn.predict(img)
21
+ return dict(zip(categories,map(float,probs)))
22
+
23
+
24
+ # %% ../cat_classifier_deployment.ipynb 8
25
+ image = gr.inputs.Image(shape=(192,192))
26
+ label = gr.outputs.Label()
27
+ examples=['dog.jpeg','cat.jpeg']
28
 
29
+ intf = gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=examples)
30
+ intf.launch(inline=False)
dog.jpeg ADDED
duck.jpeg ADDED