tdnathmlenthusiast commited on
Commit
9c32dbf
1 Parent(s): d737798

uploading model with required packages

Browse files
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+
5
+ food_names = (
6
+ 'alpine sea holly', 'anthurium', 'artichoke', 'azalea', 'ball moss', 'balloon flower', 'barbeton daisy', 'bearded iris', 'bee balm', 'bird of paradise', 'bishop of llandaff', 'black-eyed susan', 'blackberry lily', 'blanket flower', 'bolero deep blue', 'bougainvillea', 'bromelia', 'buttercup', 'californian poppy', 'camellia', 'canna lily', 'canterbury bells', 'cape flower', 'carnation', 'cautleya spicata', 'clematis', "colt's foot", 'columbine', 'common dandelion', 'corn poppy', 'cyclamen', 'daffodil', 'desert-rose', 'english marigold', 'fire lily', 'foxglove', 'frangipani', 'fritillary', 'garden phlox', 'gaura', 'gazania', 'geranium', 'giant white arum lily', 'globe thistle', 'globe-flower', 'grape hyacinth', 'great masterwort', 'hard-leaved pocket orchid', 'hibiscus', 'hippeastrum', 'japanese anemone', 'king protea', 'lenten rose', 'lotus', 'love in the mist', 'magnolia', 'mallow', 'marigold', 'mexican aster', 'mexican petunia', 'monkshood', 'moon orchid', 'morning glory', 'orange dahlia', 'osteospermum', 'oxeye daisy', 'passion flower', 'pelargonium', 'peruvian lily', 'petunia', 'pincushion flower', 'pink primrose', 'pink-yellow dahlia', 'poinsettia', 'primula', 'prince of wales feathers', 'purple coneflower', 'red ginger', 'rose', 'ruby-lipped cattleya', 'siam tulip', 'silverbush', 'snapdragon', 'spear thistle', 'spring crocus', 'stemless gentian', 'sunflower', 'sweet pea', 'sweet william', 'sword lily', 'thorn apple', 'tiger lily', 'toad lily', 'tree mallow', 'tree poppy', 'trumpet creeper', 'wallflower', 'water lily', 'watercress', 'wild pansy', 'windflower', 'yellow iris'
7
+ )
8
+
9
+ model = load_learner('final_flowers_dataset_v_1.pkl')
10
+
11
+
12
+ def food_item_names(image):
13
+ pred, idx, probs = model.predict(image)
14
+ print(pred, idx, probs)
15
+ return dict(zip(food_names, map(float, probs)))
16
+
17
+
18
+ image = gr.inputs.Image(shape=(192, 192))
19
+ label = gr.outputs.Label(num_top_classes=5)
20
+
21
+ examples = [
22
+ 'samples/test_1.jpg',
23
+ 'samples/test_2.jpg',
24
+ 'samples/test_3.jpg'
25
+ ]
26
+
27
+ iface = gr.Interface(fn=food_item_names, inputs=image,
28
+ outputs=label, examples=examples)
29
+ iface.launch(inline=True)
final_flowers_dataset_v_1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d766204dc89e887baa104db3f37a148b15b7f2bc96576f27079beba072ded9a5
3
+ size 103229994
samples/test_1.jpg ADDED
samples/test_2.jpg ADDED
samples/test_3.jpg ADDED