Daanalytics

Plotting F1 Circuit Locations into a map on Streamlit on Hugging Face using Folium

In my last blogpost I showed how to plot F1 Circuit Locations into a map using Folium on Streamlit Cloud. The idea is to switch between the World, a possible Continent and a possible Country. Check the video below.

Streamlit App – Plotting F1 Circuit Locations into a map on Streamlit Cloud using Folium

Hugging Face

Alternative step would be setting things up Streamlit on Hugging Face. The Hugging Face setup for Streamlit is pretty clear in the documentation.

Create a Streamlit Space

  • Give the Space a Name
  • Select License (optional)
  • Select the Space SDK
    • Streamlit
  • Select the Space Hardware
  • Choose Public or Private
  • Create Space

Get started with your Streamlit Space

I chose to go for the hint and ‘Create the app.py file right in your browser alternatively’. Make sure you call your app-file; app.py otherwise it doesn’t work.

I used the same code as I used previously. The only thing I had to change is the connection to Snowflake. In Streamlit Cloud I use the secrets in the settings of the app. In Hugging Face it’s a similar concept where I used separate environment variables.

Via the settings tab you can add the necessary environment variabels to connect to Snowflake:

  • user
  • password
  • role
  • account

The way these environment variable work between Hugging Face and Snowflake is slightly different.

Don’t forget to add the requirements.txt-file. Make sure you have the right (and in my case the latest) versions of the libraries you use in your code.

The app will start building.

After a while, the app complets building and is; ‘Running’

Closing Statements

In the previous example(s) I provided the steps to plot F1 Circuit Locations into a map using Folium; a Python library used for visualizing Geospatial Data.

In the first example it was a very static version where I plotted the F1 Circuit Locations either for the World, Europe or France. These options were hardcoded in the notebook and showed after each other.

In the second example I added some interactivity with Streamlit. The idea was to switch between the World, a possible Continent and a possible Country based on selected radio buttons in the sidebar.

The third example shows the same setup but then from the Streamlit Cloud. The code is on GitHub.

In this final example I went over to deploy the same app on Hugging Face.

Till next time.

Daan Bakboord – DaAnalytics

Bekijk ook:

Why didn't we see this coming?

Why didn’t we see this coming?

Early this month I attended the two days International Master Class in Strategic Intelligence executed by Rodenberg Tillman & Associates. If you’re really determined to move beyond simply gathering data and truly understand its strategic impact, this Master Class is designed for you. The Master Class is built around the Six Building Blocks™, ensuring comprehensive coverage of the critical aspects of Strategic Management and Intelligence. It’s perfect for business professionals who aim to excel by integrating Strategic Intelligence into their everyday practices, gaining the insights necessary to not only anticipate, but shape the future.

Lees verder »
Amsterdam User Group Meeting October 2024

Snowflake Dutch User Group – October 2024

Last night I had the privilege to organize a Snowflake ❄️ User Group in Snowflake’s Amsterdam Office.

Johan van der Kooij shared his experiences regarding optimizing Snowflake from a cost & performance perspective. He shared practical hints, as well as example queries, that you can use to optimize your Snowflake environment.

Lees verder »
Snowflake Data Cloud Summit - Wrap Up

Snowflake Snowflake Data Cloud Summit — Wrap Up

Snowflake Data Cloud Summit proved that after all this years the core idea remains the same and is still strong. Technology should serve and Snowflake makes things simple. One Single Unified Platform, one product and one engine. Ease of use and Govenance. Maximum efficiency and maximum simplicity.

Bring the processing of data to the data instead of the other way around. Snowflake as a Platform where you build and share your Data, Apps and AI Products. Your data never has to leave the Platform and Snowflake takes care of this Platform.

Lees verder »