farcasclaudiu commited on
Commit
ded25f1
·
1 Parent(s): 26fb56e
Files changed (2) hide show
  1. app.py +5 -26
  2. requirements.txt +2 -0
app.py CHANGED
@@ -1,12 +1,3 @@
1
- # %% [markdown]
2
- # Dogs vs Cats
3
-
4
- # %%
5
- # |default_exp app
6
- # !pip install gradio
7
-
8
- # %%
9
- # |export
10
  from fastai.vision.all import *
11
  import gradio as gr
12
 
@@ -15,22 +6,13 @@ def is_cat(x):
15
  return x[0].isupper()
16
 
17
 
18
- # %%
19
- im = PILImage.create("dog.jpg")
20
- im.thumbnail((192, 192))
21
- im
22
-
23
- # %%
24
- # |export
25
 
26
  learn = load_learner("model.pkl")
 
27
 
28
- # %%
29
- # %time learn.predict(im)
30
- learn.predict(im)
31
-
32
- # %%
33
- # |export
34
  categories = ("Dog", "Cat")
35
 
36
 
@@ -39,11 +21,8 @@ def classify_image(img):
39
  return dict(zip(categories, map(float, probs)))
40
 
41
 
42
- # %%
43
- classify_image(im)
44
 
45
- # %%
46
- # |export
47
  image = gr.inputs.Image(shape=(192, 192))
48
  label = gr.outputs.Label()
49
  examples = ["dog.jpg", "cat.jpg", "dunno.jpg"]
 
 
 
 
 
 
 
 
 
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
 
6
  return x[0].isupper()
7
 
8
 
9
+ # im = PILImage.create("dog.jpg")
10
+ # im.thumbnail((192, 192))
11
+ # im
 
 
 
 
12
 
13
  learn = load_learner("model.pkl")
14
+ # learn.predict(im)
15
 
 
 
 
 
 
 
16
  categories = ("Dog", "Cat")
17
 
18
 
 
21
  return dict(zip(categories, map(float, probs)))
22
 
23
 
24
+ # classify_image(im)
 
25
 
 
 
26
  image = gr.inputs.Image(shape=(192, 192))
27
  label = gr.outputs.Label()
28
  examples = ["dog.jpg", "cat.jpg", "dunno.jpg"]
requirements.txt CHANGED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ gradio