Spaces:
Runtime error
Runtime error
File size: 925 Bytes
04c5a65 a188ca7 04c5a65 a188ca7 04c5a65 a188ca7 04c5a65 | 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 | 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 🚀")
|