arihantvyavhare commited on
Commit
e551c67
1 Parent(s): 13537a7

gradio web app ready

Browse files
Files changed (6) hide show
  1. app.ipynb +0 -0
  2. app.py +16 -11
  3. converter_update.py +1 -1
  4. dell 20.jpg +3 -0
  5. dell inspiron.jpg +3 -0
  6. desktop pc on table.jpg +3 -0
app.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -1,27 +1,32 @@
1
- # AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
2
 
3
- __all__ = ['is_cat', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
4
-
5
- # Cell
6
  from fastai.vision.all import *
7
  import gradio as gr
8
 
9
  def is_cat(x): return x[0].isupper()
10
 
11
- # Cell
12
- learn = load_learner('model.pkl')
13
 
14
- # Cell
15
- categories = ('Dog', 'Cat')
 
 
 
 
 
 
 
16
 
17
  def classify_image(img):
18
  pred,idx,probs = learn.predict(img)
19
  return dict(zip(categories, map(float,probs)))
20
 
21
- # Cell
22
  image = gr.inputs.Image(shape=(192, 192))
23
  label = gr.outputs.Label()
24
- examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
25
 
26
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
27
- intf.launch(inline=False)
 
 
 
 
 
1
 
2
+ # %%
 
 
3
  from fastai.vision.all import *
4
  import gradio as gr
5
 
6
  def is_cat(x): return x[0].isupper()
7
 
 
 
8
 
9
+
10
+
11
+
12
+
13
+ # %%
14
+ learn = load_learner('export.pkl')
15
+
16
+ # %%
17
+ categories = ('desktop pc','laptop','mobile phone')
18
 
19
  def classify_image(img):
20
  pred,idx,probs = learn.predict(img)
21
  return dict(zip(categories, map(float,probs)))
22
 
23
+ # %%
24
  image = gr.inputs.Image(shape=(192, 192))
25
  label = gr.outputs.Label()
26
+ examples = ['dell 20.jpg', 'dell inspiron.jpg', 'desktop pc on table.jpg']
27
 
28
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
29
+ intf.launch(inline=False)
30
+
31
+ # %%
32
+ ## end -
converter_update.py CHANGED
@@ -15,7 +15,7 @@ py_file = open(f"{filename}.py", "w+")
15
 
16
  for cell in code['cells']:
17
  if cell['cell_type'] == 'code':
18
- if cell['source'] and "#| export" in cell['source'][0]:
19
  py_file.write("# %%\n") #you can comment out this line
20
  for line in cell['source'][1:]:
21
  py_file.write(line)
 
15
 
16
  for cell in code['cells']:
17
  if cell['cell_type'] == 'code':
18
+ if cell['source'] and (("#| export" in cell['source'][0]) or("#|export" in cell['source'][0]) ):
19
  py_file.write("# %%\n") #you can comment out this line
20
  for line in cell['source'][1:]:
21
  py_file.write(line)
dell 20.jpg ADDED

Git LFS Details

  • SHA256: d52c6800ee4e80b1ed1f376c4e10eacd1d6f932ef0e34fccb614aa66466c819f
  • Pointer size: 130 Bytes
  • Size of remote file: 46.2 kB
dell inspiron.jpg ADDED

Git LFS Details

  • SHA256: 3da12480e26a09bb97ee8850ecce0a14a89ee828c7b93676c78d03d294bc60ee
  • Pointer size: 131 Bytes
  • Size of remote file: 219 kB
desktop pc on table.jpg ADDED

Git LFS Details

  • SHA256: 44b86470fda26c700bc6398080762862ad79bfdc41699b25dfa99e501037ba00
  • Pointer size: 130 Bytes
  • Size of remote file: 52.6 kB