Siddharth Maddali commited on
Commit
e0fc84b
β€’
1 Parent(s): a692c75

tweak to file structure

Browse files
simple_image_classifier/app.py β†’ app.py RENAMED
@@ -1,10 +1,10 @@
1
- # AUTOGENERATED! DO NOT EDIT! File to edit: ../four-way-classifier.ipynb.
2
 
3
  # %% auto 0
4
  __all__ = ['learn', 'categories', 'model', 'description', 'image', 'label', 'examples', 'interf', 'get_best_layout',
5
  'create_plots', 'classify_image']
6
 
7
- # %% ../four-way-classifier.ipynb 1
8
  from fastai.vision.all import *
9
  import gradio as gr
10
  import PIL
@@ -15,14 +15,14 @@ import primefac
15
  from torchviz import make_dot
16
  from pytorch_grad_cam.utils.image import preprocess_image
17
 
18
- # %% ../four-way-classifier.ipynb 2
19
  warnings.filterwarnings( 'ignore' )
20
  warnings.simplefilter( 'ignore' )
21
 
22
  # plt.rcParams[ 'figure.figsize' ] = [ 15, 15 ]
23
  plt.rcParams[ 'figure.autolayout' ] = True
24
 
25
- # %% ../four-way-classifier.ipynb 3
26
  def get_best_layout( num_imgs, img_size ):
27
  prime_factors = list( primefac.primefac( num_imgs ) )
28
  aspect_ratios = []
@@ -73,12 +73,12 @@ def classify_image( img ):
73
 
74
  return ( dict( zip( categories, map( float, probs ) ) ), im1, im2, im3 )
75
 
76
- # %% ../four-way-classifier.ipynb 4
77
  learn = load_learner( 'simple-image-classifier.pkl' )
78
  categories = [ 'bird', 'forest', 'otter', 'snake' ]
79
  model = learn.model.eval()
80
 
81
- # %% ../four-way-classifier.ipynb 5
82
  description='''
83
  A simple 4-way classifier that categorizes images as 'snake', 'bird', 'otter' or 'forest'.
84
  Refined from an initial ResNet18 model downloaded from HuggingFace.
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: four-way-classifier.ipynb.
2
 
3
  # %% auto 0
4
  __all__ = ['learn', 'categories', 'model', 'description', 'image', 'label', 'examples', 'interf', 'get_best_layout',
5
  'create_plots', 'classify_image']
6
 
7
+ # %% four-way-classifier.ipynb 1
8
  from fastai.vision.all import *
9
  import gradio as gr
10
  import PIL
 
15
  from torchviz import make_dot
16
  from pytorch_grad_cam.utils.image import preprocess_image
17
 
18
+ # %% four-way-classifier.ipynb 2
19
  warnings.filterwarnings( 'ignore' )
20
  warnings.simplefilter( 'ignore' )
21
 
22
  # plt.rcParams[ 'figure.figsize' ] = [ 15, 15 ]
23
  plt.rcParams[ 'figure.autolayout' ] = True
24
 
25
+ # %% four-way-classifier.ipynb 3
26
  def get_best_layout( num_imgs, img_size ):
27
  prime_factors = list( primefac.primefac( num_imgs ) )
28
  aspect_ratios = []
 
73
 
74
  return ( dict( zip( categories, map( float, probs ) ) ), im1, im2, im3 )
75
 
76
+ # %% four-way-classifier.ipynb 4
77
  learn = load_learner( 'simple-image-classifier.pkl' )
78
  categories = [ 'bird', 'forest', 'otter', 'snake' ]
79
  model = learn.model.eval()
80
 
81
+ # %% four-way-classifier.ipynb 5
82
  description='''
83
  A simple 4-way classifier that categorizes images as 'snake', 'bird', 'otter' or 'forest'.
84
  Refined from an initial ResNet18 model downloaded from HuggingFace.
simple_image_classifier/.ipynb_checkpoints/app-checkpoint.py DELETED
@@ -1,15 +0,0 @@
1
- # AUTOGENERATED! DO NOT EDIT! File to edit: ../gradio_test.ipynb.
2
-
3
- # %% auto 0
4
- __all__ = ['iface', 'greet']
5
-
6
- # %% ../gradio_test.ipynb 1
7
- import gradio as gr
8
-
9
- # %% ../gradio_test.ipynb 3
10
- def greet( name ):
11
- return 'Hello %s!!'%name
12
-
13
- iface = gr.Interface( fn=greet, inputs='text', outputs='text' )
14
- iface.launch( inline=True )
15
-