area444 commited on
Commit
eec9f2b
·
verified ·
1 Parent(s): ed4f224

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -75,6 +75,7 @@ def get_month_label(i):
75
  #df = pd.read_csv(StringIO(data_predictions_.decode('utf-8')))
76
  #df['revenue'] = (df['vintage_unique_cases'] / df['predicted_monthly_payment_rate']).round(2)
77
  #df['Month'] = [get_month_label(i) for i in range(len(df))]
 
78
 
79
  def update_table(start_date, end_date, window, user_text):
80
  #############################################################################################
@@ -133,8 +134,6 @@ def update_table(start_date, end_date, window, user_text):
133
  return {error: str(e)}
134
  #############################################################################################
135
  global df # Use global variable
136
- #df = pd.read_csv('ok_csv.csv')
137
- #df = df_payments.copy()
138
  df = df_predictions.copy()
139
  return df
140
 
@@ -169,17 +168,10 @@ with gr.Blocks(fill_height=True) as demo:
169
  prediction_input = gr.Text(label="Month Prediction:", placeholder="Enter date (e.g., 2024-10-31)", max_lines=1)
170
  range_input = gr.Slider(1, 10, 6, label="Window / Moving Average Period")
171
 
172
- #table_ = gr.DataFrame(value=df, label="Predictions (consult 'revenue' column):")
173
- table_ = gr.DataFrame(value='', label="Predictions (consult 'revenue' column):")
174
  btn_update = gr.Button("Run Forecast")
175
-
176
- #with gr.Row():
177
- # file_name_input = gr.Textbox(label="CSV Name", placeholder="Predictions.csv")
178
- # btn_saving = gr.Button("Save CSV")
179
 
180
  btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input, user_text], outputs=table_)
181
- #btn_saving.click(fn=save_csv, inputs=file_name_input, outputs=gr.Textbox(label="File Status:"))
182
-
183
 
184
  # Configure the buttons and the panel visibility
185
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1]) # Hide Panel 1 and show Panel 2
 
75
  #df = pd.read_csv(StringIO(data_predictions_.decode('utf-8')))
76
  #df['revenue'] = (df['vintage_unique_cases'] / df['predicted_monthly_payment_rate']).round(2)
77
  #df['Month'] = [get_month_label(i) for i in range(len(df))]
78
+ df = pd.DataFrame()
79
 
80
  def update_table(start_date, end_date, window, user_text):
81
  #############################################################################################
 
134
  return {error: str(e)}
135
  #############################################################################################
136
  global df # Use global variable
 
 
137
  df = df_predictions.copy()
138
  return df
139
 
 
168
  prediction_input = gr.Text(label="Month Prediction:", placeholder="Enter date (e.g., 2024-10-31)", max_lines=1)
169
  range_input = gr.Slider(1, 10, 6, label="Window / Moving Average Period")
170
 
171
+ table_ = gr.DataFrame(value=df, label="Predictions (consult 'revenue' column):")
 
172
  btn_update = gr.Button("Run Forecast")
 
 
 
 
173
 
174
  btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input, user_text], outputs=table_)
 
 
175
 
176
  # Configure the buttons and the panel visibility
177
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1]) # Hide Panel 1 and show Panel 2