import streamlit as st import altair as alt import numpy as np import pandas as pd st.set_page_config(page_title="Spiral Demo", layout="centered") st.title("🎨 Spiral Generator with Streamlit") st.write("Adjust the sliders to generate a customizable spiral. Perfect for HuggingFace Spaces!") num_points = st.slider("Number of points in the spiral", 100, 10000, 1500) num_turns = st.slider("Number of turns in the spiral", 1, 300, 30) indices = np.linspace(0, 1, num_points) theta = 2 * np.pi * num_turns * indices radius = indices x = radius * np.cos(theta) y = radius * np.sin(theta) df = pd.DataFrame({"x": x, "y": y, "t": indices}) chart = ( alt.Chart(df) .mark_line(color="orange") .encode( x="x:Q", y="y:Q", tooltip=["x", "y", "t"] ) .properties(width=600, height=600) ) st.altair_chart(chart, use_container_width=True) st.write("Made for HuggingFace Spaces 🚀")