import numpy as np import pandas as pd import gradio as gr def greet(year,co2_emission,No2_emission,so2_emission,Global_Warming,Methane_emission): #1996 #data collection data1=pd.read_excel("FINAL_DATASET.xlsx") df1 = data1.drop(['YEAR'], axis=1) #data indexing x=df1.iloc[:,1:].values y=df1.iloc[:,0].values np.reshape(y,(-1,1)) #split the dataset from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split( x, y, test_size=0.33, random_state=42) #traing the dataset from sklearn.linear_model import LinearRegression reg = LinearRegression().fit(X_train, y_train) y_pred1=reg.predict([[co2_emission,No2_emission,so2_emission,Global_Warming,Methane_emission]]) #Equation total1="2.29209688*(x1)+(-17.24834114)(x2)+(-34.46449984)(x3)+441.88734541(x4)+(-10.5704468)*(x5)+3032.3276611889232" #app section if(year==1996): return total1,y_pred1 demo = gr.Interface( fn=greet, inputs=['number','number','number','number','number','number'], outputs=['text','number'], title="BARA SHIGRI", ) demo.launch()