jhowardjr commited on
Commit
98b6bde
1 Parent(s): 06cd147

let's deploy to huggingface spaces

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,7 +1,23 @@
 
 
 
 
 
 
 
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: is_a_cat.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'labels', 'is_cat', 'predict']
5
+
6
+ # %% is_a_cat.ipynb 1
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ def is_cat(x): return x[0].isupper()
11
+
12
+ # %% is_a_cat.ipynb 2
13
+ learn = load_learner('model.pkl')
14
+
15
+ # %% is_a_cat.ipynb 3
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
+ # %% is_a_cat.ipynb 4
23
+ gr.Interface(fn=predict, inputs="image", outputs="label").launch(share=False)