Spaces:
Runtime error
Runtime error
| import altair as alt | |
| import numpy as np | |
| import pandas as pd | |
| import streamlit as st | |
| # We only touch verifiers to prove it imports on 3.11+ | |
| import verifiers as vf | |
| st.set_page_config(page_title="Reverse-Text + Spiral Demo", layout="centered") | |
| st.title("π Reverse-Text & Spiral Demo") | |
| st.caption(f"verifiers version β {vf.__version__}") | |
| # --- Reverse-text toy -------------------------------------------------------- | |
| st.subheader("Reverse a string") | |
| text_in = st.text_input("Text to reverse") | |
| if st.button("Do it!"): | |
| st.code(text_in[::-1]) | |
| # --- Spiral scatterplot (your original example) ----------------------------- | |
| st.divider() | |
| st.subheader("Parametric spiral (just for fun)") | |
| pts = st.slider("Number of points", 50, 10_000, 1_000) | |
| turns = st.slider("Turns", 1, 300, 31) | |
| idx = np.linspace(0, 1, pts) | |
| theta, r = 2 * np.pi * turns * idx, idx | |
| x, y = r * np.cos(theta), r * np.sin(theta) | |
| df = pd.DataFrame({"x": x, "y": y, "idx": idx, "rnd": np.random.randn(pts)}) | |
| st.altair_chart( | |
| alt.Chart(df, height=650, width=650) | |
| .mark_point(filled=True) | |
| .encode( | |
| x=alt.X("x", axis=None), | |
| y=alt.Y("y", axis=None), | |
| color=alt.Color("idx", legend=None, scale=alt.Scale()), | |
| size=alt.Size("rnd", legend=None, | |
| scale=alt.Scale(range=[1, 150])), | |
| ), | |
| use_container_width=True, | |
| ) |