NaokiOkamoto commited on
Commit
4ca00a8
1 Parent(s): 8cd33f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -45,7 +45,7 @@ def get_prediction_result():
45
  df.loc[df['forecast_point'].isnull(), 'forecast_point'] = df['target_date'].apply(lambda x:x-relativedelta(months=1))
46
  df = df.loc[~((df['target_date']<(today+relativedelta(months=1)))&(df['電気代'].isnull()))]
47
  df = df.rename(columns={'電気代':'電気代_予測'})
48
- return df[['forecast_point', 'target_date', '電気代_予測']]
49
 
50
  def plot_prediction_result():
51
  update = gr.LinePlot.update(
@@ -133,6 +133,8 @@ with gr.Blocks() as electoric_ploting:
133
  """
134
  )
135
  with gr.Tab("予測結果"):
 
 
136
  with gr.Row():
137
  with gr.Column():
138
  plot = gr.LinePlot(show_label=False)
@@ -147,7 +149,7 @@ with gr.Blocks() as electoric_ploting:
147
  gr.Textbox(df['電気代_予測'].median(),
148
  label='現在までの予測値の中央値')
149
  with gr.Row():
150
- gr.DataFrame(get_prediction_result)
151
 
152
 
153
  with gr.Tab("モデル情報"):
@@ -241,13 +243,14 @@ with gr.Blocks() as electoric_ploting:
241
  )
242
 
243
  retrain_btn.click(retrain, inputs=None, outputs = [output_model_type, output_acc, output_plot])
 
244
 
245
 
246
- electoric_ploting.load(lambda: datetime.datetime.now(),
247
  None,
248
- # c_time2,
249
  every=3600)
250
- dep = electoric_ploting.load(plot_prediction_result, None, plot, every=3600)
251
 
252
  electoric_ploting.launch()
253
 
 
45
  df.loc[df['forecast_point'].isnull(), 'forecast_point'] = df['target_date'].apply(lambda x:x-relativedelta(months=1))
46
  df = df.loc[~((df['target_date']<(today+relativedelta(months=1)))&(df['電気代'].isnull()))]
47
  df = df.rename(columns={'電気代':'電気代_予測'})
48
+ return df[['forecast_point', 'target_date', '電気代_予測']], df[['forecast_point', 'target_date', '電気代_予測']]
49
 
50
  def plot_prediction_result():
51
  update = gr.LinePlot.update(
 
133
  """
134
  )
135
  with gr.Tab("予測結果"):
136
+ with gr.Row():
137
+ reload_btn= gr.Button(value="再読み込み")
138
  with gr.Row():
139
  with gr.Column():
140
  plot = gr.LinePlot(show_label=False)
 
149
  gr.Textbox(df['電気代_予測'].median(),
150
  label='現在までの予測値の中央値')
151
  with gr.Row():
152
+ output_dataframe = gr.DataFrame()
153
 
154
 
155
  with gr.Tab("モデル情報"):
 
243
  )
244
 
245
  retrain_btn.click(retrain, inputs=None, outputs = [output_model_type, output_acc, output_plot])
246
+ retrain_btn.click(retrain, inputs=None, outputs = [output_model_type, output_acc, output_plot])
247
 
248
 
249
+ electoric_ploting.load(plot_prediction_result,
250
  None,
251
+ [plot, output_dataframe],
252
  every=3600)
253
+ # dep = electoric_ploting.load(plot_prediction_result, None, [plot, output_dataframe], every=3600)
254
 
255
  electoric_ploting.launch()
256