File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,12 @@ def render_template(template, dataset):
8686 else :
8787 kwargs ["filesize" ] = "N/A"
8888
89+ # Compute download_url based on presence of url in the dataset
90+ if kwargs .get ("url" ) and kwargs ["url" ] != "" :
91+ kwargs ["download_url" ] = kwargs ["url" ]
92+ else :
93+ kwargs ["download_url" ] = f"https://data.aifarms.org/download/{ dataset } "
94+
8995 keywords = set (["AIFARMS" ])
9096 keywords .update (kwargs .get ("keywords" , "" ))
9197 kwargs ["aifarms_keywords" ] = keywords
@@ -263,7 +269,7 @@ def downloads():
263269def serve_image (dataset , name ):
264270 import mimetypes
265271 from flask import abort , send_file
266- allowed_exts = {".png" , ".jpg" , ".jpeg" }
272+ allowed_exts = {".png" , ".jpg" , ".jpeg" , ".gif" }
267273 ext = os .path .splitext (name )[1 ].lower ()
268274 if ext not in allowed_exts :
269275 abort (404 )
Original file line number Diff line number Diff line change 88 "conformsTo" : " http://mlcommons.org/croissant/1.0" ,
99 "description" : " {{ short_description }}" ,
1010 "citeAs" : " {{ citation }}" ,
11+ {% if license and license != 'N/A' and license != '' % }
1112 "license" : " https://data.aifarms.org/license/{{ dataset }}" ,
13+ {% endif % }
1214 "url" : " https://data.aifarms.org/view/{{ dataset }}" ,
1315 "datePublished" : " {{ created }}" ,
1416 "creator" : [
2830 {
2931 "@type" : " cr:FileSet" ,
3032 "@id" : " {{ dataset }}.zip" ,
31- "contentUrl" : " https://data.aifarms.org/download/{{ dataset }}" ,
33+ "contentUrl" : " {{ download_url }}" ,
34+ {% if filesize and filesize != 'N/A' and filesize != '' % }
3235 "contentSize" : " {{ filesize }}" ,
36+ {% endif % }
3337 "encodingFormat" : " application/x-zip-compressed"
3438 }
3539 ],
Original file line number Diff line number Diff line change 3838 < div id ="nextToCarousel " class ="col-3 position-absolute top-0 end-0 " >
3939 < div class ="vstack gap-3 ">
4040 < row >
41- {% if filesize and filesize != 'N/A' and filesize != '' %}
42- < a href ="download/ {{ dataset }} "> < button type ="submit " data-bs-toggle ="tooltip " data-bs-placement ="top "
41+ {% if ( filesize and filesize != 'N/A' and filesize != '') or (url and url != '') %}
42+ < a href ="{{ download_url }} "> < button type ="submit " data-bs-toggle ="tooltip " data-bs-placement ="top "
4343 title ="Download " class ="btn btn-secondary bi bi-cloud-download "> </ button > </ a >
4444 {% endif %}
4545 {% if license and license != 'N/A' and license != '' %}
You can’t perform that action at this time.
0 commit comments