Spaces:
Running
Running
Commit
·
4dd23d4
1
Parent(s):
8b8c9a9
Forgot to add in code to handle missing gbif image
Browse files
app.py
CHANGED
@@ -66,8 +66,13 @@ table_header = """**Example Guide**
|
|
66 |
table_body = ''
|
67 |
gbif_scale = 150
|
68 |
for example in example_metadata:
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
species = f"*{example['organism']}*"
|
72 |
idigbio_link = f"https://www.idigbio.org/portal/records/{example['idigbio_specimen']}"
|
73 |
intrageneric_group = example['intrageneric_group']
|
|
|
66 |
table_body = ''
|
67 |
gbif_scale = 150
|
68 |
for example in example_metadata:
|
69 |
+
if 'gbif_media' in example:
|
70 |
+
image_src = f"<image src = 'https://api.gbif.org/v1/image/cache/fit-in/{gbif_scale}x/occurrence/{example['gbif_occurrence']}/media/{example['gbif_media']}'></image>"
|
71 |
+
elif 'idigbio_media' in example:
|
72 |
+
image_src = f"<image src = 'https://api.idigbio.org/v2/media/{example['idigbio_media']}?size=thumbnail'></image>"
|
73 |
+
else:
|
74 |
+
image_src = '[No image source]'
|
75 |
+
|
76 |
species = f"*{example['organism']}*"
|
77 |
idigbio_link = f"https://www.idigbio.org/portal/records/{example['idigbio_specimen']}"
|
78 |
intrageneric_group = example['intrageneric_group']
|