area444 commited on
Commit
4a257f4
·
verified ·
1 Parent(s): 187b34f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -77,7 +77,7 @@ def get_month_label(i):
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
  #############################################################################################
82
  try:
83
  DATABRICKS_INSTANCE = 'https://136286767906206.6.gcp.databricks.com'
@@ -90,7 +90,7 @@ def update_table(start_date, end_date, window, user_text):
90
  "month_train_starting": str(start_date),
91
  "month_for_prediction": str(end_date),
92
  "moving_average_period": str(window),
93
- "username": str(user_text)
94
  }
95
 
96
  url = f"{DATABRICKS_INSTANCE}/api/2.1/jobs/run-now"
@@ -123,7 +123,7 @@ def update_table(start_date, end_date, window, user_text):
123
  print(f"Run ID: {run_id}")
124
  #data_payments = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_payments.csv")
125
  #data_metrics = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_metrics.csv")
126
- data_predictions = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_predictions_"+str(str(user_text).split('@'))[0]+".csv")
127
  #df_payments = pd.read_csv(StringIO(data_payments.decode('utf-8')))
128
  #new_columns = ['vintage', 'vintage_unique_cases'] + [f'M{col}' for col in df_payments.columns[2:]]
129
  #df_metrics = pd.read_csv(StringIO(data_metrics.decode('utf-8')))
@@ -161,7 +161,7 @@ with gr.Blocks(fill_height=True) as demo:
161
  # demo.load(update_message, None, gr.Markdown())
162
  # logout_button = gr.Button("Logout", link="/logout", scale=0)
163
  # Add a second button inside Panel 2 to hide the panel and show Panel 1 again
164
- tu = gr.Textbox(label="Usuario", interactive=False)
165
  btn_2 = gr.Button("Logout", visible=True, scale=0)
166
  btn_2.click(hide_and_show_panel, outputs=[panel_2, panel_1, user_text, input_text]) # Hide Panel 2 and show Panel 1
167
  with gr.Row():
 
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, tu):
81
  #############################################################################################
82
  try:
83
  DATABRICKS_INSTANCE = 'https://136286767906206.6.gcp.databricks.com'
 
90
  "month_train_starting": str(start_date),
91
  "month_for_prediction": str(end_date),
92
  "moving_average_period": str(window),
93
+ "username": str(tu)
94
  }
95
 
96
  url = f"{DATABRICKS_INSTANCE}/api/2.1/jobs/run-now"
 
123
  print(f"Run ID: {run_id}")
124
  #data_payments = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_payments.csv")
125
  #data_metrics = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_metrics.csv")
126
+ data_predictions = get_databricks_file("dbfs:/dbfs/FileStore/forecast_alleviatetax_predictions_"+str(tu).split('@')[0]+".csv")
127
  #df_payments = pd.read_csv(StringIO(data_payments.decode('utf-8')))
128
  #new_columns = ['vintage', 'vintage_unique_cases'] + [f'M{col}' for col in df_payments.columns[2:]]
129
  #df_metrics = pd.read_csv(StringIO(data_metrics.decode('utf-8')))
 
161
  # demo.load(update_message, None, gr.Markdown())
162
  # logout_button = gr.Button("Logout", link="/logout", scale=0)
163
  # Add a second button inside Panel 2 to hide the panel and show Panel 1 again
164
+ tu = gr.Textbox(interactive=False, scale=0)
165
  btn_2 = gr.Button("Logout", visible=True, scale=0)
166
  btn_2.click(hide_and_show_panel, outputs=[panel_2, panel_1, user_text, input_text]) # Hide Panel 2 and show Panel 1
167
  with gr.Row():