Spaces:
Runtime error
Runtime error
File size: 2,694 Bytes
e341431 a70cb7e 061ece4 a70cb7e 061ece4 c1c59bb be0e4a8 c1c59bb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
---
title: Solara Template
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
app_port: 8765
---
NOTE: The YAML header above is required for HuggingFace Spaces deployment. Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
-----
[](https://gitpod.io/#https://github.com/boettiger-lab/solara-test)
# Simple Solara demo
This respository demonstrates how we can deploy an interactive map tool from a few lines of python to an app on HuggingFace spaces using Solara.
[Solara App on HuggingFace](https://huggingface.co/spaces/cboettig/solara-test)
### Overview
This application accesses boundary polygons from the National Parks Service and fire polygon data from CalFire to determine the location of all recorded fires in Joshua Tree national park. We select the largest area fire since 2015 in the database (currently turns out to be Elk Trail Fire) and access all Sentinel-2 imagery from the two weeks before and after the fire alarm date. From this imagery, we compute the Normalized Burn Severity metric (NBS) around the fire polygon before and after the fire (using cloud-native approach of `pystac`, `odc.stac`, and dask), and plot this on a leaflet map overlay with splitmap and fire polygons.
### Code
The required code for analysis is in `fire.py`, with solara visualization in `pages/01_leafmap.py`. (For interactive use, see `solar-app.pynb`)
### Actions
This repository uses three GitHub Actions:
- π¦ [`docker.yml`](.github/workflows/docker.yml) builds the Dockerfile and pushes to GitHub Container Registry
- π€ [`sync-hf.yml`](.github/workflows/sync-hf.yml) syncs the GitHub repo to HuggingFace Spaces repo, which renders the Solara App via Dockerfile.
- π» [`compute.yml`](.github/workflows/compute.yml) Runs the `fire.py` script using the Docker container environment, and pushes the resulting COGs to π€ huggingface datasets.
### Credentials
This demo uses only free and open source resources. The only credentials required are a HuggingFace token to deploy datasets (via git-lfs) and HuggingFace Spaces (for the Solara App). This deployment could use other mechanisms instead, these options are simple and free.
### Environments
This setup tries to be simple and portable. Select "use devcontainer" when opening in a local VSCode instance, select "Open in Codespaces" from the "Code" button menu in GitHub, or use the Gipod button to access a VSCode editor running in the containerized environment. Or simply open in your favorite python editor and install the `requirements.txt` file yourself.
|