File size: 1,379 Bytes
a3b9c81
 
 
 
 
e6e56fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
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,
)