Download src/streamlit_app.py from mzcore/app: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/mzcore/app/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/mzcore/app/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/mzcore/app/resolve/main/src/streamlit_app.py
1.13 kB
| import altair as alt | |
| import numpy as np | |
| import pandas as pd | |
| import streamlit as st | |
| """ | |
| # Welcome to MZ Labora! | |
| Agora = a central place for collaborative science | |
| MZ Labora = Mass Spectrometry Laboratory + Agora | |
| A App will be built here. Until then enjoy this editable spiral :) | |
| commit 28, force, completely hide git workflow. incidentally also removes all previous commits. | |
| sync workflow changed to manual trigger | |
| """ | |
| num_points = st.slider("Number of points in spiral", 1, 10000, 1100) | |
| num_turns = st.slider("Number of turns in spiral", 1, 300, 31) | |
| 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, | |
| "idx": indices, | |
| "rand": np.random.randn(num_points), | |
| }) | |
| st.altair_chart(alt.Chart(df, height=700, width=700) | |
| .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("rand", legend=None, scale=alt.Scale(range=[1, 150])), | |
| )) |