Py.Cafe

Sindhup24/

solara-interactive-clicker

Solara Interactive Clicker

DocsPricing
  • app.py
  • requirements.txt
app.py
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
import altair as alt
from vega_datasets import data
import solara

# Define the Altair chart
def create_chart():
    states = alt.topo_feature(data.us_10m.url, feature='states')
    
    chart = alt.Chart(states).mark_geoshape().encode(
        color='id:Q'
    ).project(
        type='albersUsa'
    ).properties(
        width=800,
        height=600
    )
    
    return chart

# Define the Solara application component
@solara.component
def GeoPlotApp():
    chart = create_chart()
    solara.AltairChart(chart)

# Run the application and generate a shareable link
solara.run(GeoPlotApp, share=True)  # Use port 8501 or any available port