Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
import Generate
|
|
|
4 |
|
5 |
example_df_aircomp=pd.read_csv('data/aircompressordata.csv')
|
6 |
example_df_ener=pd.read_csv('data/energymeter.csv')
|
@@ -20,19 +21,6 @@ def pred_boiler(date):
|
|
20 |
preds=Generate.inference_boiler(date,example_df_boiler)
|
21 |
return preds
|
22 |
|
23 |
-
def plotgraphsAircomp():
|
24 |
-
preds=Generate.inference_Aircomp(date,example_df_aircomp)
|
25 |
-
|
26 |
-
# Assuming 'df' is your DataFrame object
|
27 |
-
for col in preds.columns[1:]: # skip first column (datetime)
|
28 |
-
plt.figure()
|
29 |
-
plt.plot(df['timestamp'], df[col])
|
30 |
-
plt.xlabel('Datetime')
|
31 |
-
plt.ylabel(f'{col} value')
|
32 |
-
plt.title(f'Prediction of {col} vs Date')
|
33 |
-
|
34 |
-
return plt
|
35 |
-
|
36 |
with demo:
|
37 |
gr.Markdown("Tool for predicting the next seven days of data in the future using the last 200 points of data incoming")
|
38 |
with gr.Tabs():
|
@@ -65,10 +53,20 @@ with demo:
|
|
65 |
with gr.Column():
|
66 |
Boiler_output_btn=gr.Button("Forecast")
|
67 |
boiler_plot_forecast=gr.Button("Plot")
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
Aircomp_output_btn.click(pred_air,inputs=Air_input,outputs=Air_dataframe_output)
|
70 |
Energy_output_btn.click(pred_ener,inputs=ener_input,outputs=Ener_dataframe_output)
|
71 |
Boiler_output_btn.click(pred_boiler,inputs=boiler_input,outputs=boiler_dataframe_output)
|
72 |
-
|
|
|
73 |
|
74 |
demo.launch(share=True)
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
import Generate
|
4 |
+
import plotly.express as px
|
5 |
|
6 |
example_df_aircomp=pd.read_csv('data/aircompressordata.csv')
|
7 |
example_df_ener=pd.read_csv('data/energymeter.csv')
|
|
|
21 |
preds=Generate.inference_boiler(date,example_df_boiler)
|
22 |
return preds
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
with demo:
|
25 |
gr.Markdown("Tool for predicting the next seven days of data in the future using the last 200 points of data incoming")
|
26 |
with gr.Tabs():
|
|
|
53 |
with gr.Column():
|
54 |
Boiler_output_btn=gr.Button("Forecast")
|
55 |
boiler_plot_forecast=gr.Button("Plot")
|
56 |
+
|
57 |
+
def plotg_air(dataframe):
|
58 |
+
fig=px.line(dataframe,x='timestamp',y=dataframe.columns,
|
59 |
+
hover_data={"timestamp":"|%B %d, %Y"},
|
60 |
+
title="Predictions")
|
61 |
+
fig.update_xaxes(
|
62 |
+
dtick="D1",
|
63 |
+
tickformat="%b\n%Y"
|
64 |
+
)
|
65 |
+
return fig
|
66 |
Aircomp_output_btn.click(pred_air,inputs=Air_input,outputs=Air_dataframe_output)
|
67 |
Energy_output_btn.click(pred_ener,inputs=ener_input,outputs=Ener_dataframe_output)
|
68 |
Boiler_output_btn.click(pred_boiler,inputs=boiler_input,outputs=boiler_dataframe_output)
|
69 |
+
|
70 |
+
Air_plot_forecast.click(inputs=Air_dataframe_output,outputs=Air_plots)
|
71 |
|
72 |
demo.launch(share=True)
|