Update app.py
Browse files
app.py
CHANGED
@@ -7,219 +7,7 @@ from streamlit_option_menu import option_menu
|
|
7 |
import base64
|
8 |
|
9 |
#add botanical names and usefulness
|
10 |
-
botanical_names = {
|
11 |
-
"pink_primrose": "Primula polyantha",
|
12 |
-
"hard-leaved pocket orchid": "Calypso bulbosa",
|
13 |
-
"canterbury bells": "Campanula medium",
|
14 |
-
"sweet pea": "Lathyrus odoratus",
|
15 |
-
"english marigold": "Calendula officinalis",
|
16 |
-
"tiger lily": "Lilium lancifolium",
|
17 |
-
"moon orchid": "Phalaenopsis amabilis",
|
18 |
-
"bird of paradise": "Strelitzia reginae",
|
19 |
-
"monkshood": "Aconitum napellus",
|
20 |
-
"globe thistle": "Echinops ritro",
|
21 |
-
"snapdragon": "Antirrhinum majus",
|
22 |
-
"colt's foot": "Tussilago farfara",
|
23 |
-
"king protea": "Protea cynaroides",
|
24 |
-
"spear thistle": "Cirsium vulgare",
|
25 |
-
"yellow iris": "Iris pseudacorus",
|
26 |
-
"globe-flower": "Trollius europaeus",
|
27 |
-
"purple coneflower": "Echinacea purpurea",
|
28 |
-
"peruvian lily": "Alstroemeria aurea",
|
29 |
-
"balloon flower": "Platycodon grandiflorus",
|
30 |
-
"giant white arum lily": "Zantedeschia aethiopica",
|
31 |
-
"fire lily": "Lilium bulbiferum",
|
32 |
-
"pincushion flower": "Scabiosa atropurpurea",
|
33 |
-
"fritillary": "Fritillaria imperialis",
|
34 |
-
"red ginger": "Alpinia purpurata",
|
35 |
-
"grape hyacinth": "Muscari",
|
36 |
-
"corn poppy": "Papaver rhoeas",
|
37 |
-
"prince of wales feathers": "Amaranthus caudatus",
|
38 |
-
"stemless gentian": "Gentiana acaulis",
|
39 |
-
"artichoke": "Cynara cardunculus",
|
40 |
-
"sweet william": "Dianthus barbatus",
|
41 |
-
"carnation": "Dianthus caryophyllus",
|
42 |
-
"garden phlox": "Phlox paniculata",
|
43 |
-
"love in the mist": "Nigella damascena",
|
44 |
-
"mexican aster": "Cosmos bipinnatus",
|
45 |
-
"alpine sea holly": "Eryngium alpinum",
|
46 |
-
"ruby-lipped cattleya": "Cattleya labiata",
|
47 |
-
"cape flower": "Mesembryanthemum crystallinum",
|
48 |
-
"great masterwort": "Astrantia major",
|
49 |
-
"siam tulip": "Curcuma alismatifolia",
|
50 |
-
"lenten rose": "Helleborus orientalis",
|
51 |
-
"barbeton daisy": "Gerbera jamesonii",
|
52 |
-
"daffodil": "Narcissus",
|
53 |
-
"sword lily": "Gladiolus",
|
54 |
-
"poinsettia": "Euphorbia pulcherrima",
|
55 |
-
"bolero deep blue": "Eustoma grandiflorum",
|
56 |
-
"wallflower": "Erysimum",
|
57 |
-
"marigold": "Tagetes",
|
58 |
-
"buttercup": "Ranunculus",
|
59 |
-
"oxeye daisy": "Leucanthemum vulgare",
|
60 |
-
"common dandelion": "Taraxacum officinale",
|
61 |
-
"petunia": "Petunia",
|
62 |
-
"wild pansy": "Viola tricolor",
|
63 |
-
"primula": "Primula",
|
64 |
-
"sunflower": "Helianthus",
|
65 |
-
"pelargonium": "Pelargonium",
|
66 |
-
"bishop of llandaff": "Dahlia",
|
67 |
-
"gaura": "Gaura",
|
68 |
-
"geranium": "Geranium",
|
69 |
-
"orange dahlia": "Dahlia",
|
70 |
-
"pink-yellow dahlia": "Dahlia",
|
71 |
-
"cautleya spicata": "Cautleya spicata",
|
72 |
-
"japanese anemone": "Anemone hupehensis",
|
73 |
-
"black-eyed susan": "Rudbeckia hirta",
|
74 |
-
"silverbush": "Convolvulus cneorum",
|
75 |
-
"californian poppy": "Eschscholzia californica",
|
76 |
-
"osteospermum": "Osteospermum",
|
77 |
-
"spring crocus": "Crocus vernus",
|
78 |
-
"bearded iris": "Iris germanica",
|
79 |
-
"windflower": "Anemone nemorosa",
|
80 |
-
"tree poppy": "Dendromecon rigida",
|
81 |
-
"gazania": "Gazania",
|
82 |
-
"azalea": "Rhododendron",
|
83 |
-
"water lily": "Nymphaea",
|
84 |
-
"rose": "Rosa",
|
85 |
-
"thorn apple": "Datura",
|
86 |
-
"morning glory": "Ipomoea",
|
87 |
-
"passion flower": "Passiflora",
|
88 |
-
"lotus": "Nelumbo nucifera",
|
89 |
-
"toad lily": "Tricyrtis hirta",
|
90 |
-
"anthurium": "Anthurium",
|
91 |
-
"frangipani": "Plumeria",
|
92 |
-
"clematis": "Clematis",
|
93 |
-
"hibiscus": "Hibiscus",
|
94 |
-
"columbine": "Aquilegia",
|
95 |
-
"desert-rose": "Adenium obesum",
|
96 |
-
"tree mallow": "Malva arborea",
|
97 |
-
"magnolia": "Magnolia",
|
98 |
-
"cyclamen": "Cyclamen",
|
99 |
-
"watercress": "Nasturtium officinale",
|
100 |
-
"canna lily": "Canna",
|
101 |
-
"hippeastrum": "Hippeastrum",
|
102 |
-
"bee balm": "Monarda",
|
103 |
-
"ball moss": "Tillandsia recurvata",
|
104 |
-
"foxglove": "Digitalis purpurea",
|
105 |
-
"bougainvillea": "Bougainvillea",
|
106 |
-
"camellia": "Camellia",
|
107 |
-
"mallow": "Malva",
|
108 |
-
"mexican petunia": "Ruellia brittoniana",
|
109 |
-
"bromelia": "Bromelia",
|
110 |
-
"blanket flower": "Gaillardia",
|
111 |
-
"trumpet creeper": "Campsis radicans",
|
112 |
-
"blackberry lily": "Belamcanda chinensis",
|
113 |
-
# Add the botanical names for the rest of the flowers
|
114 |
-
# You can use online resources to find the botanical names for each flower
|
115 |
-
}
|
116 |
|
117 |
-
# Define a dictionary mapping each flower's common name to its usefulness or importance
|
118 |
-
usefulness = {
|
119 |
-
"pink primrose": "Used in herbal medicine for its anti-inflammatory properties",
|
120 |
-
"hard-leaved pocket orchid": "Rare and endangered species, protected by conservation efforts",
|
121 |
-
"canterbury bells": "Ornamental garden plant, attracts bees and butterflies",
|
122 |
-
"sweet pea": "Popular ornamental plant known for its fragrance and colorful flowers",
|
123 |
-
"english marigold": "Used in traditional medicine and culinary applications",
|
124 |
-
"tiger lily": "Ornamental garden plant, symbolizing wealth and prosperity in some cultures",
|
125 |
-
"moon orchid": "Highly valued ornamental plant, often used in floral arrangements",
|
126 |
-
"bird of paradise": "Distinctive and exotic ornamental plant, symbolizing freedom and beauty",
|
127 |
-
"monkshood": "Highly toxic plant used in traditional medicine with extreme caution",
|
128 |
-
"globe thistle": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
129 |
-
"snapdragon": "Popular garden plant with colorful flowers, often used in floral arrangements",
|
130 |
-
"colt's foot": "Used in traditional medicine for its expectorant properties",
|
131 |
-
"king protea": "National flower of South Africa, symbolizing diversity and courage",
|
132 |
-
"spear thistle": "Prickly plant with ornamental value and historical significance",
|
133 |
-
"yellow iris": "Ornamental water plant, attracts pollinators such as bees and butterflies",
|
134 |
-
"globe-flower": "Ornamental garden plant, symbolizing happiness and good fortune",
|
135 |
-
"purple coneflower": "Medicinal plant used to boost the immune system and treat colds",
|
136 |
-
"peruvian lily": "Ornamental garden plant with colorful flowers, often used in floral arrangements",
|
137 |
-
"balloon flower": "Ornamental garden plant, symbolizing unchanging love and devotion",
|
138 |
-
"giant white arum lily": "Ornamental garden plant, often used in bridal bouquets",
|
139 |
-
"fire lily": "Ornamental garden plant, symbolizing passion and desire",
|
140 |
-
"pincushion flower": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
141 |
-
"fritillary": "Ornamental garden plant, known for its unique bell-shaped flowers",
|
142 |
-
"red ginger": "Ornamental garden plant, prized for its vibrant red inflorescence",
|
143 |
-
"grape hyacinth": "Ornamental garden plant, symbolizing rebirth and renewal",
|
144 |
-
"corn poppy": "Symbolic flower of remembrance, often found in fields and meadows",
|
145 |
-
"prince of wales feathers": "Ornamental garden plant, known for its striking red inflorescence",
|
146 |
-
"stemless gentian": "Medicinal plant used to treat digestive disorders",
|
147 |
-
"artichoke": "Edible plant cultivated for its edible flower buds",
|
148 |
-
"sweet william": "Ornamental garden plant with fragrant flowers, symbolizing gallantry",
|
149 |
-
"carnation": "Popular cut flower with various symbolic meanings, often used in bouquets",
|
150 |
-
"garden phlox": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
151 |
-
"love in the mist": "Ornamental garden plant with delicate flowers, symbolizing affection",
|
152 |
-
"mexican aster": "Ornamental garden plant with colorful flowers, attracts pollinators",
|
153 |
-
"alpine sea holly": "Ornamental garden plant, known for its distinctive blue flowers",
|
154 |
-
"ruby-lipped cattleya": "Highly prized orchid species, often used in corsages",
|
155 |
-
"cape flower": "Ornamental garden plant, symbolizing resilience and endurance",
|
156 |
-
"great masterwort": "Medicinal plant used to treat various ailments",
|
157 |
-
"siam tulip": "Ornamental garden plant, symbolizing prosperity and abundance",
|
158 |
-
"lenten rose": "Ornamental garden plant, prized for its early blooming flowers",
|
159 |
-
"barbeton daisy": "Ornamental garden plant with colorful flowers, attracts pollinators",
|
160 |
-
"daffodil": "Symbolic flower of renewal and hope, often associated with spring",
|
161 |
-
"sword lily": "Ornamental garden plant with striking sword-shaped leaves",
|
162 |
-
"poinsettia": "Popular ornamental plant, often used as a decorative plant during the holidays",
|
163 |
-
"bolero deep blue": "Ornamental garden plant with deep blue flowers, symbolizing tranquility",
|
164 |
-
"wallflower": "Ornamental garden plant, known for its fragrant flowers",
|
165 |
-
"marigold": "Used in traditional medicine and culinary applications, often planted to repel pests",
|
166 |
-
"buttercup": "Ornamental garden plant with bright yellow flowers",
|
167 |
-
"oxeye daisy": "Ornamental garden plant with daisy-like flowers, symbolizing innocence",
|
168 |
-
"common dandelion": "Edible plant with various medicinal properties",
|
169 |
-
"petunia": "Popular garden plant with colorful flowers, symbolizing playfulness",
|
170 |
-
"wild pansy": "Medicinal plant used to treat respiratory ailments",
|
171 |
-
"primula": "Ornamental garden plant, known for its early spring blooms",
|
172 |
-
"sunflower": "Symbolic flower of happiness and vitality, cultivated for its edible seeds",
|
173 |
-
"pelargonium": "Ornamental garden plant, known for its fragrant leaves and flowers",
|
174 |
-
"bishop of llandaff": "Ornamental garden plant with deep red flowers",
|
175 |
-
"gaura": "Ornamental garden plant with delicate flowers, attracts pollinators",
|
176 |
-
"geranium": "Popular garden plant with colorful flowers and fragrant leaves",
|
177 |
-
"orange dahlia": "Ornamental garden plant with vibrant orange flowers",
|
178 |
-
"pink-yellow dahlia": "Ornamental garden plant with pink and yellow bicolor flowers",
|
179 |
-
"cautleya spicata": "Ornamental garden plant, known for its showy flowers",
|
180 |
-
"japanese anemone": "Ornamental garden plant with delicate flowers, symbolizing protection",
|
181 |
-
"black-eyed susan": "Ornamental garden plant with yellow flowers and dark centers",
|
182 |
-
"silverbush": "Ornamental garden plant with silvery foliage",
|
183 |
-
"californian poppy": "Ornamental garden plant with bright orange flowers",
|
184 |
-
"osteospermum": "Ornamental garden plant with colorful daisy-like flowers",
|
185 |
-
"spring crocus": "Ornamental garden plant with early spring blooms",
|
186 |
-
"bearded iris": "Ornamental garden plant with showy flowers, often used in landscaping",
|
187 |
-
"windflower": "Ornamental garden plant with delicate flowers, symbolizing anticipation",
|
188 |
-
"tree poppy": "Ornamental garden plant with bright yellow flowers",
|
189 |
-
"gazania": "Ornamental garden plant with colorful flowers, drought tolerant",
|
190 |
-
"azalea": "Ornamental garden plant with vibrant flowers, symbolizing passion",
|
191 |
-
"water lily": "Ornamental water plant, symbolizing purity and enlightenment",
|
192 |
-
"rose": "Symbolic flower of love and romance, cultivated for its beauty and fragrance",
|
193 |
-
"thorn apple": "Historically used in herbal medicine, highly toxic if ingested",
|
194 |
-
"morning glory": "Ornamental garden plant with colorful flowers, symbolizing affection",
|
195 |
-
"passion flower": "Symbolic flower of Christ's passion, often used in religious art",
|
196 |
-
"lotus": "Symbolic flower of purity and enlightenment in various cultures",
|
197 |
-
"toad lily": "Ornamental garden plant with unique spotted flowers",
|
198 |
-
"anthurium": "Ornamental plant with distinctive heart-shaped flowers, symbolizing hospitality and abundance",
|
199 |
-
"frangipani": "Ornamental garden plant with fragrant flowers, often used in tropical landscaping",
|
200 |
-
"clematis": "Ornamental garden plant with colorful flowers, symbolizing mental beauty",
|
201 |
-
"hibiscus": "Edible plant with medicinal properties, popular ornamental garden plant",
|
202 |
-
"columbine": "Ornamental garden plant with unique spurred flowers, symbolizing love and fidelity",
|
203 |
-
"desert-rose": "Ornamental garden plant with succulent foliage and colorful flowers",
|
204 |
-
"tree mallow": "Ornamental garden plant with large colorful flowers",
|
205 |
-
"magnolia": "Ornamental garden plant with large fragrant flowers, symbolizing nobility and perseverance",
|
206 |
-
"cyclamen": "Ornamental garden plant with unique twisted flowers, symbolizing resignation and farewell",
|
207 |
-
"watercress": "Edible aquatic plant, rich in vitamins and minerals",
|
208 |
-
"canna lily": "Ornamental garden plant with colorful flowers and edible rhizomes",
|
209 |
-
"hippeastrum": "Ornamental garden plant with large showy flowers, symbolizing pride and beauty",
|
210 |
-
"bee balm": "Medicinal plant with aromatic leaves and flowers, attracts pollinators",
|
211 |
-
"ball moss": "Epiphytic plant that grows on trees, contributes to ecosystem biodiversity",
|
212 |
-
"foxglove": "Medicinal plant used to treat heart conditions, highly toxic if ingested",
|
213 |
-
"bougainvillea": "Ornamental vine with vibrant flowers, drought tolerant",
|
214 |
-
"camellia": "Ornamental garden plant with evergreen leaves and showy flowers",
|
215 |
-
"mallow": "Edible and medicinal plant with soothing properties",
|
216 |
-
"mexican petunia": "Ornamental garden plant with colorful flowers, attracts butterflies",
|
217 |
-
"bromelia": "Ornamental plant with colorful foliage and unique inflorescence",
|
218 |
-
"blanket flower": "Ornamental garden plant with daisy-like flowers, drought tolerant",
|
219 |
-
"trumpet creeper": "Ornamental vine with trumpet-shaped flowers, attracts hummingbirds",
|
220 |
-
"blackberry lily": "Ornamental garden plant with iris-like flowers and blackberry-like fruits"
|
221 |
-
# Add the usefulness or importance for the rest of the flowers
|
222 |
-
}
|
223 |
|
224 |
useful = "Ornamental plant with colorful foliage and unique inflorescence"
|
225 |
|
@@ -269,6 +57,220 @@ def load_labels():
|
|
269 |
# Define a dictionary mapping each flower's common name to its botanical name
|
270 |
|
271 |
def predict(model, labels, img):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
273 |
img_array = tf.expand_dims(img_array, 0) # Create a batch
|
274 |
|
@@ -281,13 +283,10 @@ def predict(model, labels, img):
|
|
281 |
# Debug: Print the predicted flower name
|
282 |
print(f"Predicted Flower: {flower}")
|
283 |
|
284 |
-
botanical_namea = botanical_names.get(flower)
|
285 |
-
|
286 |
botanical_name = botanical_names.get(flower, "Unknown")
|
287 |
flower_usefulness = usefulness.get(flower, "Unknown")
|
288 |
|
289 |
# Debug: Print the botanical name and usefulness
|
290 |
-
print(f"bot name: {botanical_namea}")
|
291 |
|
292 |
print(f"Botanical Name: {botanical_name}")
|
293 |
print(f"Usefulness: {flower_usefulness}")
|
|
|
7 |
import base64
|
8 |
|
9 |
#add botanical names and usefulness
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
useful = "Ornamental plant with colorful foliage and unique inflorescence"
|
13 |
|
|
|
57 |
# Define a dictionary mapping each flower's common name to its botanical name
|
58 |
|
59 |
def predict(model, labels, img):
|
60 |
+
botanical_names = {
|
61 |
+
"pink_primrose": "Primula polyantha",
|
62 |
+
"hard-leaved pocket orchid": "Calypso bulbosa",
|
63 |
+
"canterbury bells": "Campanula medium",
|
64 |
+
"sweet pea": "Lathyrus odoratus",
|
65 |
+
"english marigold": "Calendula officinalis",
|
66 |
+
"tiger lily": "Lilium lancifolium",
|
67 |
+
"moon orchid": "Phalaenopsis amabilis",
|
68 |
+
"bird of paradise": "Strelitzia reginae",
|
69 |
+
"monkshood": "Aconitum napellus",
|
70 |
+
"globe thistle": "Echinops ritro",
|
71 |
+
"snapdragon": "Antirrhinum majus",
|
72 |
+
"colt's foot": "Tussilago farfara",
|
73 |
+
"king protea": "Protea cynaroides",
|
74 |
+
"spear thistle": "Cirsium vulgare",
|
75 |
+
"yellow iris": "Iris pseudacorus",
|
76 |
+
"globe-flower": "Trollius europaeus",
|
77 |
+
"purple coneflower": "Echinacea purpurea",
|
78 |
+
"peruvian lily": "Alstroemeria aurea",
|
79 |
+
"balloon flower": "Platycodon grandiflorus",
|
80 |
+
"giant white arum lily": "Zantedeschia aethiopica",
|
81 |
+
"fire lily": "Lilium bulbiferum",
|
82 |
+
"pincushion flower": "Scabiosa atropurpurea",
|
83 |
+
"fritillary": "Fritillaria imperialis",
|
84 |
+
"red ginger": "Alpinia purpurata",
|
85 |
+
"grape hyacinth": "Muscari",
|
86 |
+
"corn poppy": "Papaver rhoeas",
|
87 |
+
"prince of wales feathers": "Amaranthus caudatus",
|
88 |
+
"stemless gentian": "Gentiana acaulis",
|
89 |
+
"artichoke": "Cynara cardunculus",
|
90 |
+
"sweet william": "Dianthus barbatus",
|
91 |
+
"carnation": "Dianthus caryophyllus",
|
92 |
+
"garden phlox": "Phlox paniculata",
|
93 |
+
"love in the mist": "Nigella damascena",
|
94 |
+
"mexican aster": "Cosmos bipinnatus",
|
95 |
+
"alpine sea holly": "Eryngium alpinum",
|
96 |
+
"ruby-lipped cattleya": "Cattleya labiata",
|
97 |
+
"cape flower": "Mesembryanthemum crystallinum",
|
98 |
+
"great masterwort": "Astrantia major",
|
99 |
+
"siam tulip": "Curcuma alismatifolia",
|
100 |
+
"lenten rose": "Helleborus orientalis",
|
101 |
+
"barbeton daisy": "Gerbera jamesonii",
|
102 |
+
"daffodil": "Narcissus",
|
103 |
+
"sword lily": "Gladiolus",
|
104 |
+
"poinsettia": "Euphorbia pulcherrima",
|
105 |
+
"bolero deep blue": "Eustoma grandiflorum",
|
106 |
+
"wallflower": "Erysimum",
|
107 |
+
"marigold": "Tagetes",
|
108 |
+
"buttercup": "Ranunculus",
|
109 |
+
"oxeye daisy": "Leucanthemum vulgare",
|
110 |
+
"common dandelion": "Taraxacum officinale",
|
111 |
+
"petunia": "Petunia",
|
112 |
+
"wild pansy": "Viola tricolor",
|
113 |
+
"primula": "Primula",
|
114 |
+
"sunflower": "Helianthus",
|
115 |
+
"pelargonium": "Pelargonium",
|
116 |
+
"bishop of llandaff": "Dahlia",
|
117 |
+
"gaura": "Gaura",
|
118 |
+
"geranium": "Geranium",
|
119 |
+
"orange dahlia": "Dahlia",
|
120 |
+
"pink-yellow dahlia": "Dahlia",
|
121 |
+
"cautleya spicata": "Cautleya spicata",
|
122 |
+
"japanese anemone": "Anemone hupehensis",
|
123 |
+
"black-eyed susan": "Rudbeckia hirta",
|
124 |
+
"silverbush": "Convolvulus cneorum",
|
125 |
+
"californian poppy": "Eschscholzia californica",
|
126 |
+
"osteospermum": "Osteospermum",
|
127 |
+
"spring crocus": "Crocus vernus",
|
128 |
+
"bearded iris": "Iris germanica",
|
129 |
+
"windflower": "Anemone nemorosa",
|
130 |
+
"tree poppy": "Dendromecon rigida",
|
131 |
+
"gazania": "Gazania",
|
132 |
+
"azalea": "Rhododendron",
|
133 |
+
"water lily": "Nymphaea",
|
134 |
+
"rose": "Rosa",
|
135 |
+
"thorn apple": "Datura",
|
136 |
+
"morning glory": "Ipomoea",
|
137 |
+
"passion flower": "Passiflora",
|
138 |
+
"lotus": "Nelumbo nucifera",
|
139 |
+
"toad lily": "Tricyrtis hirta",
|
140 |
+
"anthurium": "Anthurium",
|
141 |
+
"frangipani": "Plumeria",
|
142 |
+
"clematis": "Clematis",
|
143 |
+
"hibiscus": "Hibiscus",
|
144 |
+
"columbine": "Aquilegia",
|
145 |
+
"desert-rose": "Adenium obesum",
|
146 |
+
"tree mallow": "Malva arborea",
|
147 |
+
"magnolia": "Magnolia",
|
148 |
+
"cyclamen": "Cyclamen",
|
149 |
+
"watercress": "Nasturtium officinale",
|
150 |
+
"canna lily": "Canna",
|
151 |
+
"hippeastrum": "Hippeastrum",
|
152 |
+
"bee balm": "Monarda",
|
153 |
+
"ball moss": "Tillandsia recurvata",
|
154 |
+
"foxglove": "Digitalis purpurea",
|
155 |
+
"bougainvillea": "Bougainvillea",
|
156 |
+
"camellia": "Camellia",
|
157 |
+
"mallow": "Malva",
|
158 |
+
"mexican petunia": "Ruellia brittoniana",
|
159 |
+
"bromelia": "Bromelia",
|
160 |
+
"blanket flower": "Gaillardia",
|
161 |
+
"trumpet creeper": "Campsis radicans",
|
162 |
+
"blackberry lily": "Belamcanda chinensis",
|
163 |
+
# Add the botanical names for the rest of the flowers
|
164 |
+
# You can use online resources to find the botanical names for each flower
|
165 |
+
}
|
166 |
+
|
167 |
+
# Define a dictionary mapping each flower's common name to its usefulness or importance
|
168 |
+
usefulness = {
|
169 |
+
"pink primrose": "Used in herbal medicine for its anti-inflammatory properties",
|
170 |
+
"hard-leaved pocket orchid": "Rare and endangered species, protected by conservation efforts",
|
171 |
+
"canterbury bells": "Ornamental garden plant, attracts bees and butterflies",
|
172 |
+
"sweet pea": "Popular ornamental plant known for its fragrance and colorful flowers",
|
173 |
+
"english marigold": "Used in traditional medicine and culinary applications",
|
174 |
+
"tiger lily": "Ornamental garden plant, symbolizing wealth and prosperity in some cultures",
|
175 |
+
"moon orchid": "Highly valued ornamental plant, often used in floral arrangements",
|
176 |
+
"bird of paradise": "Distinctive and exotic ornamental plant, symbolizing freedom and beauty",
|
177 |
+
"monkshood": "Highly toxic plant used in traditional medicine with extreme caution",
|
178 |
+
"globe thistle": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
179 |
+
"snapdragon": "Popular garden plant with colorful flowers, often used in floral arrangements",
|
180 |
+
"colt's foot": "Used in traditional medicine for its expectorant properties",
|
181 |
+
"king protea": "National flower of South Africa, symbolizing diversity and courage",
|
182 |
+
"spear thistle": "Prickly plant with ornamental value and historical significance",
|
183 |
+
"yellow iris": "Ornamental water plant, attracts pollinators such as bees and butterflies",
|
184 |
+
"globe-flower": "Ornamental garden plant, symbolizing happiness and good fortune",
|
185 |
+
"purple coneflower": "Medicinal plant used to boost the immune system and treat colds",
|
186 |
+
"peruvian lily": "Ornamental garden plant with colorful flowers, often used in floral arrangements",
|
187 |
+
"balloon flower": "Ornamental garden plant, symbolizing unchanging love and devotion",
|
188 |
+
"giant white arum lily": "Ornamental garden plant, often used in bridal bouquets",
|
189 |
+
"fire lily": "Ornamental garden plant, symbolizing passion and desire",
|
190 |
+
"pincushion flower": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
191 |
+
"fritillary": "Ornamental garden plant, known for its unique bell-shaped flowers",
|
192 |
+
"red ginger": "Ornamental garden plant, prized for its vibrant red inflorescence",
|
193 |
+
"grape hyacinth": "Ornamental garden plant, symbolizing rebirth and renewal",
|
194 |
+
"corn poppy": "Symbolic flower of remembrance, often found in fields and meadows",
|
195 |
+
"prince of wales feathers": "Ornamental garden plant, known for its striking red inflorescence",
|
196 |
+
"stemless gentian": "Medicinal plant used to treat digestive disorders",
|
197 |
+
"artichoke": "Edible plant cultivated for its edible flower buds",
|
198 |
+
"sweet william": "Ornamental garden plant with fragrant flowers, symbolizing gallantry",
|
199 |
+
"carnation": "Popular cut flower with various symbolic meanings, often used in bouquets",
|
200 |
+
"garden phlox": "Ornamental garden plant, attracts pollinators such as bees and butterflies",
|
201 |
+
"love in the mist": "Ornamental garden plant with delicate flowers, symbolizing affection",
|
202 |
+
"mexican aster": "Ornamental garden plant with colorful flowers, attracts pollinators",
|
203 |
+
"alpine sea holly": "Ornamental garden plant, known for its distinctive blue flowers",
|
204 |
+
"ruby-lipped cattleya": "Highly prized orchid species, often used in corsages",
|
205 |
+
"cape flower": "Ornamental garden plant, symbolizing resilience and endurance",
|
206 |
+
"great masterwort": "Medicinal plant used to treat various ailments",
|
207 |
+
"siam tulip": "Ornamental garden plant, symbolizing prosperity and abundance",
|
208 |
+
"lenten rose": "Ornamental garden plant, prized for its early blooming flowers",
|
209 |
+
"barbeton daisy": "Ornamental garden plant with colorful flowers, attracts pollinators",
|
210 |
+
"daffodil": "Symbolic flower of renewal and hope, often associated with spring",
|
211 |
+
"sword lily": "Ornamental garden plant with striking sword-shaped leaves",
|
212 |
+
"poinsettia": "Popular ornamental plant, often used as a decorative plant during the holidays",
|
213 |
+
"bolero deep blue": "Ornamental garden plant with deep blue flowers, symbolizing tranquility",
|
214 |
+
"wallflower": "Ornamental garden plant, known for its fragrant flowers",
|
215 |
+
"marigold": "Used in traditional medicine and culinary applications, often planted to repel pests",
|
216 |
+
"buttercup": "Ornamental garden plant with bright yellow flowers",
|
217 |
+
"oxeye daisy": "Ornamental garden plant with daisy-like flowers, symbolizing innocence",
|
218 |
+
"common dandelion": "Edible plant with various medicinal properties",
|
219 |
+
"petunia": "Popular garden plant with colorful flowers, symbolizing playfulness",
|
220 |
+
"wild pansy": "Medicinal plant used to treat respiratory ailments",
|
221 |
+
"primula": "Ornamental garden plant, known for its early spring blooms",
|
222 |
+
"sunflower": "Symbolic flower of happiness and vitality, cultivated for its edible seeds",
|
223 |
+
"pelargonium": "Ornamental garden plant, known for its fragrant leaves and flowers",
|
224 |
+
"bishop of llandaff": "Ornamental garden plant with deep red flowers",
|
225 |
+
"gaura": "Ornamental garden plant with delicate flowers, attracts pollinators",
|
226 |
+
"geranium": "Popular garden plant with colorful flowers and fragrant leaves",
|
227 |
+
"orange dahlia": "Ornamental garden plant with vibrant orange flowers",
|
228 |
+
"pink-yellow dahlia": "Ornamental garden plant with pink and yellow bicolor flowers",
|
229 |
+
"cautleya spicata": "Ornamental garden plant, known for its showy flowers",
|
230 |
+
"japanese anemone": "Ornamental garden plant with delicate flowers, symbolizing protection",
|
231 |
+
"black-eyed susan": "Ornamental garden plant with yellow flowers and dark centers",
|
232 |
+
"silverbush": "Ornamental garden plant with silvery foliage",
|
233 |
+
"californian poppy": "Ornamental garden plant with bright orange flowers",
|
234 |
+
"osteospermum": "Ornamental garden plant with colorful daisy-like flowers",
|
235 |
+
"spring crocus": "Ornamental garden plant with early spring blooms",
|
236 |
+
"bearded iris": "Ornamental garden plant with showy flowers, often used in landscaping",
|
237 |
+
"windflower": "Ornamental garden plant with delicate flowers, symbolizing anticipation",
|
238 |
+
"tree poppy": "Ornamental garden plant with bright yellow flowers",
|
239 |
+
"gazania": "Ornamental garden plant with colorful flowers, drought tolerant",
|
240 |
+
"azalea": "Ornamental garden plant with vibrant flowers, symbolizing passion",
|
241 |
+
"water lily": "Ornamental water plant, symbolizing purity and enlightenment",
|
242 |
+
"rose": "Symbolic flower of love and romance, cultivated for its beauty and fragrance",
|
243 |
+
"thorn apple": "Historically used in herbal medicine, highly toxic if ingested",
|
244 |
+
"morning glory": "Ornamental garden plant with colorful flowers, symbolizing affection",
|
245 |
+
"passion flower": "Symbolic flower of Christ's passion, often used in religious art",
|
246 |
+
"lotus": "Symbolic flower of purity and enlightenment in various cultures",
|
247 |
+
"toad lily": "Ornamental garden plant with unique spotted flowers",
|
248 |
+
"anthurium": "Ornamental plant with distinctive heart-shaped flowers, symbolizing hospitality and abundance",
|
249 |
+
"frangipani": "Ornamental garden plant with fragrant flowers, often used in tropical landscaping",
|
250 |
+
"clematis": "Ornamental garden plant with colorful flowers, symbolizing mental beauty",
|
251 |
+
"hibiscus": "Edible plant with medicinal properties, popular ornamental garden plant",
|
252 |
+
"columbine": "Ornamental garden plant with unique spurred flowers, symbolizing love and fidelity",
|
253 |
+
"desert-rose": "Ornamental garden plant with succulent foliage and colorful flowers",
|
254 |
+
"tree mallow": "Ornamental garden plant with large colorful flowers",
|
255 |
+
"magnolia": "Ornamental garden plant with large fragrant flowers, symbolizing nobility and perseverance",
|
256 |
+
"cyclamen": "Ornamental garden plant with unique twisted flowers, symbolizing resignation and farewell",
|
257 |
+
"watercress": "Edible aquatic plant, rich in vitamins and minerals",
|
258 |
+
"canna lily": "Ornamental garden plant with colorful flowers and edible rhizomes",
|
259 |
+
"hippeastrum": "Ornamental garden plant with large showy flowers, symbolizing pride and beauty",
|
260 |
+
"bee balm": "Medicinal plant with aromatic leaves and flowers, attracts pollinators",
|
261 |
+
"ball moss": "Epiphytic plant that grows on trees, contributes to ecosystem biodiversity",
|
262 |
+
"foxglove": "Medicinal plant used to treat heart conditions, highly toxic if ingested",
|
263 |
+
"bougainvillea": "Ornamental vine with vibrant flowers, drought tolerant",
|
264 |
+
"camellia": "Ornamental garden plant with evergreen leaves and showy flowers",
|
265 |
+
"mallow": "Edible and medicinal plant with soothing properties",
|
266 |
+
"mexican petunia": "Ornamental garden plant with colorful flowers, attracts butterflies",
|
267 |
+
"bromelia": "Ornamental plant with colorful foliage and unique inflorescence",
|
268 |
+
"blanket flower": "Ornamental garden plant with daisy-like flowers, drought tolerant",
|
269 |
+
"trumpet creeper": "Ornamental vine with trumpet-shaped flowers, attracts hummingbirds",
|
270 |
+
"blackberry lily": "Ornamental garden plant with iris-like flowers and blackberry-like fruits"
|
271 |
+
# Add the usefulness or importance for the rest of the flowers
|
272 |
+
}
|
273 |
+
|
274 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
275 |
img_array = tf.expand_dims(img_array, 0) # Create a batch
|
276 |
|
|
|
283 |
# Debug: Print the predicted flower name
|
284 |
print(f"Predicted Flower: {flower}")
|
285 |
|
|
|
|
|
286 |
botanical_name = botanical_names.get(flower, "Unknown")
|
287 |
flower_usefulness = usefulness.get(flower, "Unknown")
|
288 |
|
289 |
# Debug: Print the botanical name and usefulness
|
|
|
290 |
|
291 |
print(f"Botanical Name: {botanical_name}")
|
292 |
print(f"Usefulness: {flower_usefulness}")
|