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