Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,13 +16,13 @@ X_min = np.min(X_for_train, axis=0)
|
|
16 |
X_max = np.max(X_for_train, axis=0)
|
17 |
|
18 |
def webai(user_input):
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
# Получаем предсказание от модели
|
24 |
-
|
25 |
-
|
26 |
if otv < 0:
|
27 |
otv = 0
|
28 |
elif otv > 100:
|
@@ -43,7 +43,7 @@ def webai(user_input):
|
|
43 |
def pomoch(age, gender, height, weight, ap_hi, ap_lo, cholesterol, gluc, smoke, alco, active):
|
44 |
try:
|
45 |
X = [int(age), gender, int(height), int(weight), int(ap_hi), int(ap_lo), float(cholesterol), float(gluc), smoke,
|
46 |
-
|
47 |
X[0] = today().year - X[0]
|
48 |
if X[1] == "Мужской":
|
49 |
X[1] = 0
|
@@ -92,4 +92,4 @@ demo = gr.Interface(
|
|
92 |
],
|
93 |
'text')
|
94 |
|
95 |
-
demo.launch()
|
|
|
16 |
X_max = np.max(X_for_train, axis=0)
|
17 |
|
18 |
def webai(user_input):
|
19 |
+
user_input_clear = user_input
|
20 |
+
input_data = [user_input_clear]
|
21 |
+
input_data_scaled = (input_data - X_min) / (X_max - X_min)
|
22 |
|
23 |
# Получаем предсказание от модели
|
24 |
+
predicted_result_scaled = model.predict(input_data_scaled)
|
25 |
+
otv = round(predicted_result_scaled[0][0] * 100, 2)
|
26 |
if otv < 0:
|
27 |
otv = 0
|
28 |
elif otv > 100:
|
|
|
43 |
def pomoch(age, gender, height, weight, ap_hi, ap_lo, cholesterol, gluc, smoke, alco, active):
|
44 |
try:
|
45 |
X = [int(age), gender, int(height), int(weight), int(ap_hi), int(ap_lo), float(cholesterol), float(gluc), smoke,
|
46 |
+
alco, active]
|
47 |
X[0] = today().year - X[0]
|
48 |
if X[1] == "Мужской":
|
49 |
X[1] = 0
|
|
|
92 |
],
|
93 |
'text')
|
94 |
|
95 |
+
demo.launch()
|