Yahia battach commited on
Commit
4e412dc
1 Parent(s): 29309b0

edit app.py

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +34 -38
.gitignore CHANGED
@@ -1,2 +1,4 @@
1
  .venv/
2
  __pycache__/
 
 
 
1
  .venv/
2
  __pycache__/
3
+
4
+ .DS_Store
app.py CHANGED
@@ -62,34 +62,30 @@ open_domain_examples = [
62
 
63
  zero_shot_examples = [
64
  [
65
- "examples/Ursus-arctos.jpeg",
66
- "brown bear\nblack bear\npolar bear\nkoala bear\ngrizzly bear",
67
  ],
68
- ["examples/milk-snake.png", "coral snake\nmilk snake"],
69
- ["examples/coral-snake.jpeg", "coral snake\nmilk snake"],
70
  [
71
- "examples/Carnegiea-gigantea.png",
72
- "Carnegiea gigantea\nSchlumbergera opuntioides\nMammillaria albicoma",
73
  ],
74
  [
75
- "examples/Amanita-muscaria.jpeg",
76
- "Amanita fulva\nAmanita vaginata (grisette)\nAmanita calyptrata (coccoli)\nAmanita crocea\nAmanita rubescens (blusher)\nAmanita caesarea (Caesar's mushroom)\nAmanita jacksonii (American Caesar's mushroom)\nAmanita muscaria (fly agaric)\nAmanita pantherina (panther cap)",
77
  ],
78
  [
79
- "examples/Actinostola-abyssorum.png",
80
- "Animalia Cnidaria Hexacorallia Actiniaria Actinostolidae Actinostola abyssorum\nAnimalia Cnidaria Hexacorallia Actiniaria Actinostolidae Actinostola bulbosa\nAnimalia Cnidaria Hexacorallia Actiniaria Actinostolidae Actinostola callosa\nAnimalia Cnidaria Hexacorallia Actiniaria Actinostolidae Actinostola capensis\nAnimalia Cnidaria Hexacorallia Actiniaria Actinostolidae Actinostola carlgreni",
81
  ],
82
  [
83
- "examples/Sarcoscypha-coccinea.jpeg",
84
- "scarlet elf cup (coccinea)\nscharlachroter kelchbecherling (austriaca)\ncrimson cup (dudleyi)\nstalked scarlet cup (occidentalis)",
85
  ],
86
  [
87
- "examples/Onoclea-hintonii.jpg",
88
- "Onoclea attenuata\nOnoclea boryana\nOnoclea hintonii\nOnoclea intermedia\nOnoclea sensibilis",
89
- ],
90
- [
91
- "examples/Onoclea-sensibilis.jpg",
92
- "Onoclea attenuata\nOnoclea boryana\nOnoclea hintonii\nOnoclea intermedia\nOnoclea sensibilis",
93
  ],
94
  ]
95
 
@@ -215,31 +211,31 @@ if __name__ == "__main__":
215
 
216
  with gr.Column():
217
  # display sample image of top predicted taxon
218
- sample_img = gr.Image(label = "Sample Image of Predicted Taxon",
219
- height = 400,
220
- show_download_button = False)
221
 
222
- taxon_url = gr.HTML(label = "More Information",
223
- elem_id = "url"
224
- )
225
-
226
- with gr.Row():
227
- with gr.Column():
228
- rank_dropdown = gr.Dropdown(
229
- label="Taxonomic Rank",
230
- info="Which taxonomic rank to predict. Fine-grained ranks (genus, species) are more challenging.",
231
- choices=ranks,
232
- value="Species",
233
- type="index",
234
- )
235
- open_domain_btn = gr.Button("Submit", variant="primary")
236
- with gr.Column():
237
  open_domain_output = gr.Label(
238
  num_top_classes=k,
239
  label="Prediction",
240
  show_label=True,
241
  value=None,
242
  )
 
 
 
 
 
 
 
 
 
 
 
 
243
  # open_domain_flag_btn = gr.Button("Flag Mistake", variant="primary")
244
 
245
  with gr.Row():
@@ -273,11 +269,11 @@ if __name__ == "__main__":
273
  with gr.Row():
274
  with gr.Column():
275
  classes_txt = gr.Textbox(
276
- placeholder="Canis familiaris (dog)\nFelis catus (cat)\n...",
277
  lines=3,
278
  label="Classes",
279
  show_label=True,
280
- info="Use taxonomic names where possible; include common names if possible.",
281
  )
282
  zero_shot_btn = gr.Button("Submit", variant="primary")
283
 
 
62
 
63
  zero_shot_examples = [
64
  [
65
+ "examples/Acropora-gemmifera.jpg",
66
+ "Acropora aculeus\nAcropora acuminata\nAcropora anthocercis\nAcropora appressa\nAcropora arabensis"
67
  ],
68
+ ["examples/porities_lobata.jpg", "Porities lobata\nPorites astreoides"],
69
+ ["examples/Euphyllia_paraancora.jpg", "Euphyllia paraancora\nEuphyllia paradivisa"],
70
  [
71
+ "examples/Montipora_patula.jpg",
72
+ "Montipora patula\nMontipora peltiformis \nMontipora saudii\nMontipora caliculata\nMontipora capitata\nMontipora cebuensis\nMontipora carinata",
73
  ],
74
  [
75
+ "examples/Astreopora_listeri.jpg",
76
+ "Animalia Cnidaria Anthozoa Scleractinia Acroporidae Acropora hyacinthus\nAnimalia Cnidaria Anthozoa Scleractinia Acroporidae Acropora aculeus\nAnimalia Cnidaria Anthozoa Scleractinia Acroporidae Acropora anthocercis\nAnimalia Cnidaria Anthozoa Scleractinia Acroporidae Acropora millepora\nAnimalia Cnidaria Anthozoa Scleractinia Acroporidae Acropora gemmifera",
77
  ],
78
  [
79
+ "examples/Turbinaria_heronensis.jpg",
80
+ "Turbinaria heronensis\nTurbinaria mesenterina\nTurbinaria patula\nTurbinaria peltata",
81
  ],
82
  [
83
+ "examples/Montipora_peltiformis.jpg",
84
+ "Montipora peltiformis\nMontipora capricornis\nMontipora carinata\nMontipora cebuensis\nMontipora circumvallata",
85
  ],
86
  [
87
+ "examples/Agaricia_agaricites.jpg",
88
+ "Agaricia agaricites\nAgaricia fragilis\nAgaricia grahamae\nAgaricia humilis\nAgaricia lamarcki",
 
 
 
 
89
  ],
90
  ]
91
 
 
211
 
212
  with gr.Column():
213
  # display sample image of top predicted taxon
214
+ # sample_img = gr.Image(label = "Sample Image of Predicted Taxon",
215
+ # height = 400,
216
+ # show_download_button = False)
217
 
218
+ # taxon_url = gr.HTML(label = "More Information",
219
+ # elem_id = "url"
220
+ # )
 
 
 
 
 
 
 
 
 
 
 
 
221
  open_domain_output = gr.Label(
222
  num_top_classes=k,
223
  label="Prediction",
224
  show_label=True,
225
  value=None,
226
  )
227
+
228
+
229
+ with gr.Row():
230
+ rank_dropdown = gr.Dropdown(
231
+ label="Taxonomic Rank",
232
+ info="Which taxonomic rank to predict. Fine-grained ranks (genus, species) are more challenging.",
233
+ choices=ranks,
234
+ value="Species",
235
+ type="index",
236
+ )
237
+ open_domain_btn = gr.Button("Submit", variant="primary")
238
+
239
  # open_domain_flag_btn = gr.Button("Flag Mistake", variant="primary")
240
 
241
  with gr.Row():
 
269
  with gr.Row():
270
  with gr.Column():
271
  classes_txt = gr.Textbox(
272
+ placeholder="Montipora peltiformis \nMontipora saudii...",
273
  lines=3,
274
  label="Classes",
275
  show_label=True,
276
+ info="Use taxonomic names",
277
  )
278
  zero_shot_btn = gr.Button("Submit", variant="primary")
279