micky21 commited on
Commit
3be09ec
·
1 Parent(s): 1a35de2

Resolve Issue

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -4,22 +4,25 @@
4
  __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% app.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
- # %% app.ipynb 3
13
  learn = load_learner("model.pkl")
14
 
15
- # %% app.ipynb 5
16
  categories = ("Dog", "Cat")
17
 
18
  def classify_image(img):
19
  pred, idx, probs = learn.predict(img)
20
  return dict(zip(categories, map(float, probs)))
21
 
22
- # %% app.ipynb 7
23
  image = gr.Image(width="192px", height="192px")
24
  label = gr.Label()
25
  examples = ["dog.jpeg", "cat.jpeg", "dunno.jpg"]
 
4
  __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% app.ipynb 1
7
+ !pip install fastai gradio nbdev
8
+
9
+ # %% app.ipynb 2
10
  from fastai.vision.all import *
11
  import gradio as gr
12
 
13
  def is_cat(x): return x[0].isupper()
14
 
15
+ # %% app.ipynb 4
16
  learn = load_learner("model.pkl")
17
 
18
+ # %% app.ipynb 6
19
  categories = ("Dog", "Cat")
20
 
21
  def classify_image(img):
22
  pred, idx, probs = learn.predict(img)
23
  return dict(zip(categories, map(float, probs)))
24
 
25
+ # %% app.ipynb 8
26
  image = gr.Image(width="192px", height="192px")
27
  label = gr.Label()
28
  examples = ["dog.jpeg", "cat.jpeg", "dunno.jpg"]