Download maplegend.py from Sowmya15/Identifying_Commercial_Centers_Using_Machine_Learning: direct link, hf CLI and curl.
- Browser
- Download file 2.32 kB
-
https://huggingface.co/spaces/Sowmya15/Identifying_Commercial_Centers_Using_Machine_Learning/resolve/main/maplegend.py
- Command line
-
hf download hf://spaces/Sowmya15/Identifying_Commercial_Centers_Using_Machine_Learning/maplegend.py
-
curl -L -o maplegend.py https://huggingface.co/spaces/Sowmya15/Identifying_Commercial_Centers_Using_Machine_Learning/resolve/main/maplegend.py
2.32 kB
| from branca.element import Template, MacroElement | |
| def temp(): | |
| #code copied from: https://nbviewer.org/gist/talbertc-usgs/18f8901fc98f109f2b71156cf3ac81cd | |
| template = """ | |
| {% macro html(this, kwargs) %} | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>jQuery UI Draggable - Default functionality</title> | |
| <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> | |
| <script src="https://code.jquery.com/jquery-1.12.4.js"></script> | |
| <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | |
| <script> | |
| $( function() { | |
| $( "#maplegend" ).draggable({ | |
| start: function (event, ui) { | |
| $(this).css({ | |
| right: "auto", | |
| top: "auto", | |
| bottom: "auto" | |
| }); | |
| } | |
| }); | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| <div id='maplegend' class='maplegend' | |
| style='position: absolute; z-index:9999; border:2px solid grey; background-color:rgba(255, 255, 255, 0.8); | |
| border-radius:6px; padding: 10px; font-size:14px; right: 20px; bottom: 20px;'> | |
| <div class='legend-scale'> | |
| <ul class='legend-labels'> | |
| <li><span style='background:red;opacity:0.7;'></span>Most Significant Cluster</li> | |
| <li><span style='background:yellow;opacity:0.7;'></span>Least Significant Cluster</li> | |
| </ul> | |
| </div> | |
| </div> | |
| </body> | |
| </html> | |
| <style type='text/css'> | |
| .maplegend .legend-scale ul { | |
| margin: 0; | |
| margin-bottom: 5px; | |
| padding: 0; | |
| float: left; | |
| list-style: none; | |
| } | |
| .maplegend .legend-scale ul li { | |
| font-size: 80%; | |
| list-style: none; | |
| margin-left: 0; | |
| line-height: 18px; | |
| margin-bottom: 2px; | |
| } | |
| .maplegend ul.legend-labels li span { | |
| display: block; | |
| float: left; | |
| height: 16px; | |
| width: 30px; | |
| margin-right: 5px; | |
| margin-left: 0; | |
| border: 1px solid #999; | |
| } | |
| .maplegend .legend-source { | |
| font-size: 80%; | |
| color: #777; | |
| clear: both; | |
| } | |
| .maplegend a { | |
| color: #777; | |
| } | |
| </style> | |
| {% endmacro %}""" | |
| macro = MacroElement() | |
| macro._template = Template(template) | |
| #map_osm.get_root().add_child(macro) | |
| return macro |