Spaces:
Sleeping
Sleeping
added some error handling for auto
Browse files- app.py +9 -2
- troubleshoot_day_model.ipynb +18 -26
app.py
CHANGED
@@ -73,7 +73,14 @@ def get_time_emojis(_times, _pst_now):
|
|
73 |
# Example usage:
|
74 |
times_list = ['06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30']
|
75 |
emojis_list, idxs = get_time_emojis(times_list, pst_now)
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
st.title('🎮 Gameday Model for $SPX')
|
79 |
st.markdown('**PLEASE NOTE:** Model should be run at or after market open. Documentation on the model and its features [can be found here.](https://huggingface.co/spaces/boomsss/gamedayspx/blob/main/README.md)')
|
@@ -106,7 +113,7 @@ with st.form("choose_model"):
|
|
106 |
option = option
|
107 |
|
108 |
if change_mode:
|
109 |
-
st.write(f
|
110 |
|
111 |
if cleared:
|
112 |
st.cache_data.clear()
|
|
|
73 |
# Example usage:
|
74 |
times_list = ['06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30']
|
75 |
emojis_list, idxs = get_time_emojis(times_list, pst_now)
|
76 |
+
|
77 |
+
def get_last_idx(arr):
|
78 |
+
try:
|
79 |
+
return len(arr) - 1 - arr[::-1].index(True)
|
80 |
+
except ValueError:
|
81 |
+
return 0
|
82 |
+
|
83 |
+
idx_use = get_last_idx(idxs)
|
84 |
|
85 |
st.title('🎮 Gameday Model for $SPX')
|
86 |
st.markdown('**PLEASE NOTE:** Model should be run at or after market open. Documentation on the model and its features [can be found here.](https://huggingface.co/spaces/boomsss/gamedayspx/blob/main/README.md)')
|
|
|
113 |
option = option
|
114 |
|
115 |
if change_mode:
|
116 |
+
st.write(f"Changed to {mode}.{' Model will run for {}.'.format(option) if mode == 'Auto' else ''}")
|
117 |
|
118 |
if cleared:
|
119 |
st.cache_data.clear()
|
troubleshoot_day_model.ipynb
CHANGED
@@ -69,51 +69,43 @@
|
|
69 |
},
|
70 |
{
|
71 |
"cell_type": "code",
|
72 |
-
"execution_count":
|
73 |
"metadata": {},
|
74 |
"outputs": [],
|
75 |
"source": [
|
76 |
-
"l = [
|
77 |
]
|
78 |
},
|
79 |
{
|
80 |
"cell_type": "code",
|
81 |
-
"execution_count":
|
82 |
"metadata": {},
|
83 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
"source": [
|
85 |
-
"place = len(l) - 1 - l[::-1].index(True)"
|
86 |
]
|
87 |
},
|
88 |
{
|
89 |
"cell_type": "code",
|
90 |
-
"execution_count":
|
91 |
"metadata": {},
|
92 |
"outputs": [],
|
93 |
"source": [
|
94 |
"z = ['a','b','c','d','e']"
|
95 |
]
|
96 |
},
|
97 |
-
{
|
98 |
-
"cell_type": "code",
|
99 |
-
"execution_count": 9,
|
100 |
-
"metadata": {},
|
101 |
-
"outputs": [
|
102 |
-
{
|
103 |
-
"data": {
|
104 |
-
"text/plain": [
|
105 |
-
"'c'"
|
106 |
-
]
|
107 |
-
},
|
108 |
-
"execution_count": 9,
|
109 |
-
"metadata": {},
|
110 |
-
"output_type": "execute_result"
|
111 |
-
}
|
112 |
-
],
|
113 |
-
"source": [
|
114 |
-
"z[place]"
|
115 |
-
]
|
116 |
-
},
|
117 |
{
|
118 |
"cell_type": "code",
|
119 |
"execution_count": 37,
|
|
|
69 |
},
|
70 |
{
|
71 |
"cell_type": "code",
|
72 |
+
"execution_count": 10,
|
73 |
"metadata": {},
|
74 |
"outputs": [],
|
75 |
"source": [
|
76 |
+
"l = [False, False, False, False, False,False,False,False]"
|
77 |
]
|
78 |
},
|
79 |
{
|
80 |
"cell_type": "code",
|
81 |
+
"execution_count": 14,
|
82 |
"metadata": {},
|
83 |
+
"outputs": [
|
84 |
+
{
|
85 |
+
"ename": "ValueError",
|
86 |
+
"evalue": "True is not in list",
|
87 |
+
"output_type": "error",
|
88 |
+
"traceback": [
|
89 |
+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
90 |
+
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
|
91 |
+
"\u001b[1;32md:\\Projects\\gamedayspx\\troubleshoot_day_model.ipynb Cell 7\u001b[0m line \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/d%3A/Projects/gamedayspx/troubleshoot_day_model.ipynb#X60sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m place \u001b[39m=\u001b[39m \u001b[39m0\u001b[39m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m l[::\u001b[39m-\u001b[39;49m\u001b[39m1\u001b[39;49m]\u001b[39m.\u001b[39;49mindex(\u001b[39mTrue\u001b[39;49;00m) \u001b[39melse\u001b[39;00m \u001b[39mlen\u001b[39m(l) \u001b[39m-\u001b[39m \u001b[39m1\u001b[39m \u001b[39m-\u001b[39m l[::\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m]\u001b[39m.\u001b[39mindex(\u001b[39mTrue\u001b[39;00m)\n",
|
92 |
+
"\u001b[1;31mValueError\u001b[0m: True is not in list"
|
93 |
+
]
|
94 |
+
}
|
95 |
+
],
|
96 |
"source": [
|
97 |
+
"place = 0 if not l[::-1].index(True) else len(l) - 1 - l[::-1].index(True)"
|
98 |
]
|
99 |
},
|
100 |
{
|
101 |
"cell_type": "code",
|
102 |
+
"execution_count": 12,
|
103 |
"metadata": {},
|
104 |
"outputs": [],
|
105 |
"source": [
|
106 |
"z = ['a','b','c','d','e']"
|
107 |
]
|
108 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
{
|
110 |
"cell_type": "code",
|
111 |
"execution_count": 37,
|