mofawzy commited on
Commit
e650d7b
1 Parent(s): 72f5617

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -6,23 +6,21 @@ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_jean
6
  # %% app.ipynb 3
7
  from fastai.vision.all import *
8
  import gradio as gr
9
- # ['jeans', 'sofa', 'tshirt', 'tv']
10
 
11
- def is_jeans(x): return x[0].isupper()
 
12
 
13
- # %% app.ipynb 5
14
  learn = load_learner('export.pkl')
15
-
16
- # %% app.ipynb 7
17
  categories = ('Jeans', 'Sofa', 'Tshirt', 'Tv')
18
 
19
  def classify_images(img):
20
  pred, idx, probs = learn.predict(img)
21
  return dict(zip(categories, map(float, probs)))
22
 
23
- # %% app.ipynb 9
24
- image = gr.components.Image(shape=(192,192))
25
- label = gr.components.Label()
 
26
  examples = ['jeans.jpeg', 'sofa.jpeg', 'tshirt.jpg', 'tv.jpeg']
27
 
28
  intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
 
6
  # %% app.ipynb 3
7
  from fastai.vision.all import *
8
  import gradio as gr
 
9
 
10
+ def is_jeans(x):
11
+ return x[0].isupper()
12
 
 
13
  learn = load_learner('export.pkl')
 
 
14
  categories = ('Jeans', 'Sofa', 'Tshirt', 'Tv')
15
 
16
  def classify_images(img):
17
  pred, idx, probs = learn.predict(img)
18
  return dict(zip(categories, map(float, probs)))
19
 
20
+ # Create an Image component with the desired size
21
+ image = gr.Image(image_mode="file", size=(192, 192))
22
+
23
+ label = gr.Label()
24
  examples = ['jeans.jpeg', 'sofa.jpeg', 'tshirt.jpg', 'tv.jpeg']
25
 
26
  intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)