Upload website.py
Browse files- website.py +54 -0
website.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import main
|
3 |
+
from dateutil.utils import today
|
4 |
+
|
5 |
+
|
6 |
+
def pomoch(age, gender, height, weight, ap_hi, ap_lo, cholesterol, gluc, smoke, alco, active):
|
7 |
+
X = [int(age), gender, int(height), int(weight), int(ap_hi), int(ap_lo), float(cholesterol), float(gluc), smoke,
|
8 |
+
alco, active]
|
9 |
+
X[0] = today().year - X[0]
|
10 |
+
if X[1] == "Мужской":
|
11 |
+
X[1] = 0
|
12 |
+
else:
|
13 |
+
X[1] = 1
|
14 |
+
for i in range(8, 11):
|
15 |
+
if X[i] == "Да":
|
16 |
+
X[i] = 1
|
17 |
+
else:
|
18 |
+
X[i] = 0
|
19 |
+
if X[6] <= 5:
|
20 |
+
X[6] = 1
|
21 |
+
else:
|
22 |
+
if X[6] >= 7.8:
|
23 |
+
X[6] = 3
|
24 |
+
else:
|
25 |
+
X[6] = 2
|
26 |
+
|
27 |
+
if X[7] <= 5.5 and X[7] >= 3.3:
|
28 |
+
X[7] = 1
|
29 |
+
else:
|
30 |
+
if (X[7] > 5.5 and X[7] < 11) or X[7] < 3.3:
|
31 |
+
X[7] = 2
|
32 |
+
else:
|
33 |
+
X[7] = 3
|
34 |
+
return main.webai(X)
|
35 |
+
|
36 |
+
|
37 |
+
demo = gr.Interface(
|
38 |
+
pomoch,
|
39 |
+
[
|
40 |
+
gr.Slider(1900, 2010, value=1990, step=1, label="Год рождения"),
|
41 |
+
gr.Radio(["Мужской", "Женский"], label="Пол", ),
|
42 |
+
gr.Textbox(label="Рост(см)"),
|
43 |
+
gr.Textbox(label="Вес(кг)"),
|
44 |
+
gr.Textbox(label="Верхнее Давление"),
|
45 |
+
gr.Textbox(label="Нижнее Давление"),
|
46 |
+
gr.Textbox(label="Холестерин(ммоль/л)"),
|
47 |
+
gr.Textbox(label="Глюкоза(ммоль/л)", ),
|
48 |
+
gr.Radio(["Да", "Нет"], label="Курение", ),
|
49 |
+
gr.Radio(["Да", "Нет"], label="Алкоголь", ),
|
50 |
+
gr.Radio(["Да", "Нет"], label="Активность", ),
|
51 |
+
],
|
52 |
+
'text')
|
53 |
+
|
54 |
+
demo.launch()
|