Capebm commited on
Commit
f405c69
·
verified ·
1 Parent(s): 0b365e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -42,7 +42,7 @@ def forecast_process_ml(data, process_name, n_future):
42
  for _ in range(n_future):
43
  future_lag_df = pd.DataFrame([future_lags], columns=X.columns)
44
  forecast = model.predict(future_lag_df)[0]
45
- forecasts.append(forecast)
46
  future_lags = future_lags[1:] + [forecast]
47
 
48
  return forecasts
@@ -76,7 +76,9 @@ default_processes = list(data['Processos'].unique())
76
 
77
  # Gradio interface
78
  def forecast_interface(month=default_month_name, process=default_processes, n_months=9):
79
- return get_forecast(month, process, n_months)
 
 
80
 
81
  # Gradio UI with CSS for black background
82
  css = """
@@ -98,4 +100,4 @@ with gr.Blocks(css=css) as iface:
98
  btn = gr.Button("Prever")
99
  btn.click(forecast_interface, inputs=[month, process, n_months], outputs=output)
100
 
101
- iface.launch()
 
42
  for _ in range(n_future):
43
  future_lag_df = pd.DataFrame([future_lags], columns=X.columns)
44
  forecast = model.predict(future_lag_df)[0]
45
+ forecasts.append(int(forecast)) # Convert forecast to integer
46
  future_lags = future_lags[1:] + [forecast]
47
 
48
  return forecasts
 
76
 
77
  # Gradio interface
78
  def forecast_interface(month=default_month_name, process=default_processes, n_months=9):
79
+ forecast_df = get_forecast(month, process, n_months)
80
+ forecast_df.to_excel("forecast_results.xlsx", index=False) # Export to Excel
81
+ return forecast_df
82
 
83
  # Gradio UI with CSS for black background
84
  css = """
 
100
  btn = gr.Button("Prever")
101
  btn.click(forecast_interface, inputs=[month, process, n_months], outputs=output)
102
 
103
+ iface.launch()