Spaces:
Runtime error
Runtime error
File size: 1,642 Bytes
33c6ed5 1f29db4 33c6ed5 1f29db4 33c6ed5 1f29db4 95d45d2 1f29db4 f92db56 33c6ed5 87536cd 33c6ed5 87536cd 33c6ed5 87536cd |
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 44 45 46 47 48 49 50 51 52 53 |
import streamlit as st
import time
import random
# Define the list of themes and nodes
themes = {
"Theme 1": ["Node 1.1", "Node 1.2", "Node 1.3", "Node 1.4", "Node 1.5", "Node 1.6", "Node 1.7", "Node 1.8", "Node 1.9", "Node 1.10"],
"Theme 2": ["Node 2.1", "Node 2.2", "Node 2.3", "Node 2.4", "Node 2.5", "Node 2.6", "Node 2.7", "Node 2.8", "Node 2.9", "Node 2.10"],
}
# Define emojis for top 1 through 10
emojis = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
def spinning_model(theme, nodes, emojis):
output = ""
for i, node in enumerate(nodes):
output += f"{emojis[i]} {node}\n"
time.sleep(0.1)
st.markdown(f"### {theme}\n{output}")
st.write("---")
def random_timer():
countdown = 5
while countdown > 0:
st.write(f"Countdown: {countdown} seconds")
time.sleep(1)
countdown -= 1
st.experimental_rerun()
st.title("Spinning Model Visualization")
st.write("Select themes to display the spinning model.")
# Add input widgets for the two themes
theme_1 = st.text_input("Theme 1:", "Theme 1")
theme_2 = st.text_input("Theme 2:", "Theme 2")
# Get the selected themes and their nodes
selected_theme_1 = themes.get(theme_1, [])
selected_theme_2 = themes.get(theme_2, [])
while True:
# Randomly select a theme to display
if random.randint(0, 1):
selected_theme = selected_theme_1
theme = theme_1
else:
selected_theme = selected_theme_2
theme = theme_2
spinning_model(theme, selected_theme, emojis)
random_timer()
st.write("---")
|