Spaces:
Sleeping
Sleeping
File size: 1,269 Bytes
f81b1c7 d1b3dc9 f81b1c7 85ac5a4 f81b1c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
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(elem_classes="output_textbox"),
)
# Launch the application
iface.launch()
|