Donald Kapyouo commited on
Commit
68b3403
·
1 Parent(s): a42f963
Files changed (4) hide show
  1. app.py +14 -4
  2. cat.jpg +0 -0
  3. dog.jpg +0 -0
  4. dogs_cats.ipynb +0 -0
app.py CHANGED
@@ -1,7 +1,17 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ def is_cat(x): return x[0].isupper()
 
5
 
6
+ learn = load_learner('export.pkl')
7
+
8
+ categories = ['cat', 'dog']
9
+
10
+ def predict_image(img):
11
+ pred, pred_idx, probs = learn.predict(img)
12
+ return dict(zip(categories, map(float, probs)))
13
+
14
+ image = gr.inputs.Image(shape=(192, 192))
15
+ label = gr.outputs.Label()
16
+ examples = ["cat.jpg", "dog.jpg"]
17
+ gr.Interface(fn=predict_image, inputs=image, outputs=label, capture_session=True).launch()
cat.jpg ADDED
dog.jpg ADDED
dogs_cats.ipynb ADDED
The diff for this file is too large to render. See raw diff