Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
import numpy as np
|
|
|
3 |
#from scipy import stats
|
4 |
from sklearn.preprocessing import MinMaxScaler, StandardScaler, PolynomialFeatures
|
5 |
from sklearn.linear_model import Ridge, ElasticNet, LinearRegression, Lasso
|
@@ -8,27 +9,32 @@ from sklearn.model_selection import train_test_split
|
|
8 |
#import dtale
|
9 |
import gradio as gr
|
10 |
|
11 |
-
# Load the dataset
|
12 |
-
df = pd.read_csv('ebw_data.csv')
|
13 |
|
14 |
-
X = df.drop(['Width', 'Depth'], axis=1)
|
15 |
-
y = df[['Width', 'Depth']]
|
16 |
|
17 |
-
# Разделим данные на трэйн и тест
|
18 |
-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
|
19 |
|
20 |
-
# Создайте экземпляр модели линейной регрессии.
|
21 |
-
model = LinearRegression()
|
22 |
|
23 |
-
# Фитим
|
24 |
-
model.fit(X_train, y_train)
|
25 |
|
26 |
-
# Предиктим
|
27 |
-
y_pred = model.predict(X_test)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
# Оценка производительности модели
|
30 |
-
score = model.score(X_test, y_test)
|
31 |
-
#print('Accuracy:', score)
|
32 |
def greet(IW, IF, VW, FP):
|
33 |
X_new = pd.DataFrame({'IW': [IW], 'IF': [IF], 'VW': [VW], 'FP': [FP]})
|
34 |
y_predd = model.predict(X_new)
|
|
|
1 |
import pandas as pd
|
2 |
import numpy as np
|
3 |
+
import pickle
|
4 |
#from scipy import stats
|
5 |
from sklearn.preprocessing import MinMaxScaler, StandardScaler, PolynomialFeatures
|
6 |
from sklearn.linear_model import Ridge, ElasticNet, LinearRegression, Lasso
|
|
|
9 |
#import dtale
|
10 |
import gradio as gr
|
11 |
|
12 |
+
# # Load the dataset
|
13 |
+
# df = pd.read_csv('ebw_data.csv')
|
14 |
|
15 |
+
# X = df.drop(['Width', 'Depth'], axis=1)
|
16 |
+
# y = df[['Width', 'Depth']]
|
17 |
|
18 |
+
# # Разделим данные на трэйн и тест
|
19 |
+
# X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
|
20 |
|
21 |
+
# # Создайте экземпляр модели линейной регрессии.
|
22 |
+
# model = LinearRegression()
|
23 |
|
24 |
+
# # Фитим
|
25 |
+
# model.fit(X_train, y_train)
|
26 |
|
27 |
+
# # Предиктим
|
28 |
+
# y_pred = model.predict(X_test)
|
29 |
+
|
30 |
+
# # Оценка производительности модели
|
31 |
+
# score = model.score(X_test, y_test)
|
32 |
+
# #print('Accuracy:', score)
|
33 |
+
filename = 'finalized_model.sav'
|
34 |
+
model = pickle.load(open(filename, 'rb'))
|
35 |
+
#result = loaded_model.score(X_test, Y_test)
|
36 |
+
# print(result)
|
37 |
|
|
|
|
|
|
|
38 |
def greet(IW, IF, VW, FP):
|
39 |
X_new = pd.DataFrame({'IW': [IW], 'IF': [IF], 'VW': [VW], 'FP': [FP]})
|
40 |
y_predd = model.predict(X_new)
|