import numpy as np import pandas as pd import statsmodels.api as sm from sklearn.preprocessing import StandardScaler import gradio as gr import pickle with open ("scaled_obj.pkl", "rb") as f: sc_object = pickle.load(f) with open ("scaled_model.pkl", "rb") as f: lin_model_object = pickle.load(f) def fn_predict(Total_Revenue,Operating_Cost,Total_Assets,Total_Liabilities,Stock_Price,Market_Cap,EBITDA,RD_Expenses,Number_of_Employees): df = np.array([[Total_Revenue,Operating_Cost,Total_Assets,Total_Liabilities,Stock_Price,Market_Cap,EBITDA,RD_Expenses,Number_of_Employees]]) scaled_new_data = sc_object.transform(df) predictions = lin_model_object.predict(scaled_new_data) return predictions # Define Gradio interface iface = gr.Interface( fn=fn_predict, inputs=[ gr.Number(label="Total Revenue"), gr.Number(label="Operating Cost"), gr.Number(label="Total Assets"), gr.Number(label="Total Liabilities"), gr.Number(label="Stock Price"), gr.Number(label="Market Cap"), gr.Number(label="EBITDA"), gr.Number(label="R&D Expenses"), gr.Number(label="Number of Employees") ], outputs=gr.Textbox() ) # Launch the application iface.launch()