Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,7 +135,7 @@ def apply_prophet(df_clean):
|
|
| 135 |
|
| 136 |
# Ensure there's enough data for Prophet to run
|
| 137 |
if data.empty or len(data) < 2:
|
| 138 |
-
st.write(f"Pular grupo {row['Rotulo']} por não ter observações suficientes.")
|
| 139 |
continue
|
| 140 |
|
| 141 |
try:
|
|
@@ -143,7 +143,7 @@ def apply_prophet(df_clean):
|
|
| 143 |
model = Prophet(interval_width=0.95)
|
| 144 |
model.fit(data)
|
| 145 |
except ValueError as e:
|
| 146 |
-
st.write(f"Pular grupo {row['Rotulo']} devido ao erro: {e}")
|
| 147 |
continue
|
| 148 |
|
| 149 |
# Make future predictions
|
|
@@ -189,10 +189,14 @@ with tab1:
|
|
| 189 |
st.warning("Não há dados válidos para processar.")
|
| 190 |
else:
|
| 191 |
# Cache the Prophet results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
if st.session_state['all_anomalies'].empty:
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
st.session_state['all_anomalies'] = all_anomalies
|
| 196 |
|
| 197 |
with tab2:
|
| 198 |
if 'all_anomalies' in st.session_state and not st.session_state['all_anomalies'].empty:
|
|
|
|
| 135 |
|
| 136 |
# Ensure there's enough data for Prophet to run
|
| 137 |
if data.empty or len(data) < 2:
|
| 138 |
+
#st.write(f"Pular grupo {row['Rotulo']} por não ter observações suficientes.")
|
| 139 |
continue
|
| 140 |
|
| 141 |
try:
|
|
|
|
| 143 |
model = Prophet(interval_width=0.95)
|
| 144 |
model.fit(data)
|
| 145 |
except ValueError as e:
|
| 146 |
+
#st.write(f"Pular grupo {row['Rotulo']} devido ao erro: {e}")
|
| 147 |
continue
|
| 148 |
|
| 149 |
# Make future predictions
|
|
|
|
| 189 |
st.warning("Não há dados válidos para processar.")
|
| 190 |
else:
|
| 191 |
# Cache the Prophet results
|
| 192 |
+
#if st.session_state['all_anomalies'].empty:
|
| 193 |
+
#with st.spinner('Aplicando modelo de série temporal...'):
|
| 194 |
+
#all_anomalies = apply_prophet(df_clean)
|
| 195 |
+
#st.session_state['all_anomalies'] = all_anomalies
|
| 196 |
+
# Cache the Prophet results
|
| 197 |
if st.session_state['all_anomalies'].empty:
|
| 198 |
+
all_anomalies = apply_prophet(df_clean)
|
| 199 |
+
st.session_state['all_anomalies'] = all_anomalies
|
|
|
|
| 200 |
|
| 201 |
with tab2:
|
| 202 |
if 'all_anomalies' in st.session_state and not st.session_state['all_anomalies'].empty:
|