import gradio as gr import pandas as pd import Generate example_df_aircomp=pd.read_csv('D:/project/aircompressordata.csv') example_df_ener=pd.read_csv('D:/project/energymeter.csv') example_df_boiler=pd.read_csv('D:/project/Boiler1.csv') demo=gr.Blocks(title="EcoForecast") def pred_air(date): preds=Generate.inference_Aircomp(date,example_df_aircomp) return preds def pred_ener(date): preds=Generate.inference_Energy(date,example_df_ener) return preds def pred_boiler(date): preds=Generate.inference_boiler(date,example_df_boiler) return preds def plotgraphs(dataframe): plots=0 return plots with demo: gr.Markdown("Tool for predicting the next seven days of data in the future using the last 200 points of data incoming") with gr.Tabs(): with gr.TabItem("Air compressor data"): with gr.Row(): Air_input=gr.Text(placeholder="Enter date and like the example only",show_label=False) air_dataframe_input=gr.Dataframe(example_df_aircomp.head(100)) Air_dataframe_output=gr.Dataframe() Air_plots=gr.Plot() with gr.Column(): Aircomp_output_btn=gr.Button("Forecast") Air_plot_forecast=gr.Button("Plot") with gr.TabItem("Energymeter data"): with gr.Row(): ener_input=gr.Text(placeholder="Enter the date and time in example format only",show_label=False) ener_dataframe_input=gr.Dataframe(example_df_ener.head(100)) Ener_dataframe_output=gr.Dataframe() Ener_plots=gr.Plot() with gr.Column(): Energy_output_btn=gr.Button("Forecast") Ener_plot_forecast=gr.Button("Plot") with gr.TabItem("Boiler data"): with gr.Row(): boiler_input=gr.Text(placeholder="Enter the date and time in example format only",show_label=False) ener_dataframe_input=gr.Dataframe(example_df_boiler.head(100)) boiler_dataframe_output=gr.Dataframe() boil_plots=gr.Plot() with gr.Column(): Boiler_output_btn=gr.Button("Forecast") boiler_plot_forecast=gr.Button("Plot") Aircomp_output_btn.click(pred_air,inputs=Air_input,outputs=Air_dataframe_output) Energy_output_btn.click(pred_ener,inputs=ener_input,outputs=Ener_dataframe_output) Boiler_output_btn.click(pred_boiler,inputs=boiler_input,outputs=boiler_dataframe_output) Air_plot_forecast.click() demo.launch(share=True)