morningduck commited on
Commit
3052b88
1 Parent(s): 20b0fd2

added model

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -1,7 +1,25 @@
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: ../app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'intf', 'classify_images']
5
+
6
+ # %% ../app.ipynb 1
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+ # %% ../app.ipynb 2
11
+ learn = load_learner('country-pred-model.pkl')
12
+
13
+ # %% ../app.ipynb 3
14
+ categories = ('mexico', 'usa')
15
+
16
+ def classify_images(img):
17
+ pred, idx, probs = learn.predict(img)
18
+ return dict(zip(categories, map(float, probs)))
19
+
20
+ # %% ../app.ipynb 6
21
+ image = gr.inputs.Image()
22
+ label = gr.outputs.Label()
23
+
24
+ intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=(''))
25
+ intf.launch(inline=False)