Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,6 @@ import random
|
|
6 |
themes = {
|
7 |
"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"],
|
8 |
"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"],
|
9 |
-
"Theme 3": ["Node 3.1", "Node 3.2", "Node 3.3", "Node 3.4", "Node 3.5", "Node 3.6", "Node 3.7", "Node 3.8", "Node 3.9", "Node 3.10"],
|
10 |
-
"Theme 4": ["Node 4.1", "Node 4.2", "Node 4.3", "Node 4.4", "Node 4.5", "Node 4.6", "Node 4.7", "Node 4.8", "Node 4.9", "Node 4.10"],
|
11 |
-
"Theme 5": ["Node 5.1", "Node 5.2", "Node 5.3", "Node 5.4", "Node 5.5", "Node 5.6", "Node 5.7", "Node 5.8", "Node 5.9", "Node 5.10"],
|
12 |
}
|
13 |
|
14 |
# Define emojis for top 1 through 10
|
@@ -31,26 +28,24 @@ def random_timer(countdown):
|
|
31 |
st.title("Spinning Model Visualization")
|
32 |
st.write("Select themes to display the spinning model and adjust the number of seconds before the next refresh.")
|
33 |
|
34 |
-
# Add input widgets for the
|
35 |
theme_1 = st.text_input("Theme 1:", "Theme 1")
|
36 |
theme_2 = st.text_input("Theme 2:", "Theme 2")
|
37 |
-
|
38 |
-
theme_4 = st.text_input("Theme 4:", "Theme 4")
|
39 |
-
theme_5 = st.text_input("Theme 5:", "Theme 5")
|
40 |
-
refresh_interval = st.slider("Refresh interval (in seconds):",1, 10, 5)
|
41 |
|
42 |
-
|
|
|
|
|
43 |
|
44 |
-
i = 0
|
45 |
while True:
|
46 |
-
#
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
random.shuffle(selected_theme)
|
49 |
-
|
50 |
-
spinning_model(
|
51 |
-
selected_theme = random_timer(refresh_interval)
|
52 |
-
|
53 |
-
# Increment the index and loop back to the first theme if all themes have been shown
|
54 |
-
i = (i + 1) % 5
|
55 |
-
if i == 0:
|
56 |
-
st.write("---")
|
|
|
6 |
themes = {
|
7 |
"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"],
|
8 |
"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"],
|
|
|
|
|
|
|
9 |
}
|
10 |
|
11 |
# Define emojis for top 1 through 10
|
|
|
28 |
st.title("Spinning Model Visualization")
|
29 |
st.write("Select themes to display the spinning model and adjust the number of seconds before the next refresh.")
|
30 |
|
31 |
+
# Add input widgets for the two themes and refresh interval
|
32 |
theme_1 = st.text_input("Theme 1:", "Theme 1")
|
33 |
theme_2 = st.text_input("Theme 2:", "Theme 2")
|
34 |
+
refresh_interval = st.slider("Refresh interval (in seconds):", 1, 10, 5)
|
|
|
|
|
|
|
35 |
|
36 |
+
# Get the selected themes and their nodes
|
37 |
+
selected_theme_1 = themes.get(theme_1, [])
|
38 |
+
selected_theme_2 = themes.get(theme_2, [])
|
39 |
|
|
|
40 |
while True:
|
41 |
+
# Randomly select a theme to display and shuffle the nodes
|
42 |
+
if random.randint(0, 1):
|
43 |
+
selected_theme = selected_theme_1
|
44 |
+
theme = theme_1
|
45 |
+
else:
|
46 |
+
selected_theme = selected_theme_2
|
47 |
+
theme = theme_2
|
48 |
random.shuffle(selected_theme)
|
49 |
+
|
50 |
+
spinning_model(theme, selected_theme, emojis)
|
51 |
+
selected_theme = random_timer(refresh_interval)
|
|
|
|
|
|
|
|
|
|