NekoNeko512 commited on
Commit
e9fd37b
·
1 Parent(s): dab0d91

usefull update

Browse files
Files changed (8) hide show
  1. Cat.jpg +0 -0
  2. Cat2.jpg +0 -0
  3. Dog.jpg +0 -0
  4. Dog.jpg:Zone.Identifier +4 -0
  5. app.py +25 -7
  6. dunno.jpg +0 -0
  7. dunno.jpg:Zone.Identifier +4 -0
  8. model.pkl +3 -0
Cat.jpg ADDED
Cat2.jpg ADDED
Dog.jpg ADDED
Dog.jpg:Zone.Identifier ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://www.dogsforgood.org/app/uploads/2020/06/Dogs-For-Good-October-22-2019-308.jpg
4
+ HostUrl=https://www.dogsforgood.org/app/uploads/2020/06/Dogs-For-Good-October-22-2019-308.jpg
app.py CHANGED
@@ -1,7 +1,25 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../02x-prototype_gradio_interface.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learner', 'classes', 'examples', 'interface', 'is_cat', 'predict']
5
+
6
+ # %% ../02x-prototype_gradio_interface.ipynb 1
7
+ import gradio as gr
8
+ from fastai.vision.all import *
9
+ def is_cat(x):
10
+ return x[0].isupper()
11
+
12
+ # %% ../02x-prototype_gradio_interface.ipynb 2
13
+ learner = load_learner('model.pkl')
14
+
15
+ # %% ../02x-prototype_gradio_interface.ipynb 5
16
+ classes = ('Dog', 'Cat')
17
+ def predict(img):
18
+ label, size, probs = learner.predict(img)
19
+ return dict(zip(classes, map(float, probs)))
20
+
21
+
22
+ # %% ../02x-prototype_gradio_interface.ipynb 6
23
+ examples = ["Dog.jpg", "Cat.jpg", "Cat2.jpg", "dunno.jpg"]
24
+ interface = gr.Interface(fn=predict, inputs='image', outputs='label', examples=examples)
25
+ interface.launch()
dunno.jpg ADDED
dunno.jpg:Zone.Identifier ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRLpfHHL0DCw6guvT_B8ccRu-5TO1a98G63Ag&s
4
+ HostUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRLpfHHL0DCw6guvT_B8ccRu-5TO1a98G63Ag&s
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cef7f9ccda46c0f307660ad11658439f955c96fbe5a55a74e883f402df7f7049
3
+ size 47064894