from fasthtml.common import * app = FastHTML() rt = app.route style=""" #map { height: 180px; } """ js = """ function load() { var map = L.map('mapid').setView([51.505, -0.09], 13); L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '© OpenStreetMap' }).addTo(map); } """ @rt('/') def get(): return Titled("MinorityMap", Link(rel="stylesheet", href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"), Style(style), Script(src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"), Body(onload='load()', Div(id='mapid')), Script(js) ) serve()