MaxJalo commited on
Commit
d647f76
·
verified ·
1 Parent(s): a7ba7fc

Update website.py

Browse files
Files changed (1) hide show
  1. website.py +9 -1
website.py CHANGED
@@ -1,12 +1,19 @@
1
  from huggingface_hub import hf_hub_download
2
  import gradio as gr
 
3
  import tensorflow as tf
4
  import numpy as np
5
  from dateutil.utils import today
 
6
 
7
  model_path = hf_hub_download(repo_id="MaxJalo/CardioAI", filename="cardioai_model.keras")
8
  model = tf.keras.models.load_model(model_path)
9
 
 
 
 
 
 
10
 
11
  def webai(user_input):
12
  user_input_clear = user_input
@@ -22,7 +29,8 @@ def webai(user_input):
22
  # 47 1 168 87 120 80 2 1 1 1 1
23
  # 37 0 185 75 120 80 2 1 1 1 0
24
  return f"{round(predicted_result_scaled[0][0] * 100, 2)}%"
25
-
 
26
  def pomoch(age, gender, height, weight, ap_hi, ap_lo, cholesterol, gluc, smoke, alco, active):
27
  X = [int(age), gender, int(height), int(weight), int(ap_hi), int(ap_lo), float(cholesterol), float(gluc), smoke,
28
  alco, active]
 
1
  from huggingface_hub import hf_hub_download
2
  import gradio as gr
3
+ import pandas as pd
4
  import tensorflow as tf
5
  import numpy as np
6
  from dateutil.utils import today
7
+ from datasets import load_dataset
8
 
9
  model_path = hf_hub_download(repo_id="MaxJalo/CardioAI", filename="cardioai_model.keras")
10
  model = tf.keras.models.load_model(model_path)
11
 
12
+ heart = load_dataset("MaxJalo/CardioAI", split = 'train')
13
+ data = pd.DataFrame(heart, columns=["age","gender","height","weight","ap_hi","ap_lo","cholesterol","gluc","smoke","alco","active",'cardio'])
14
+ X_for_train = data.drop(['cardio'], axis=1).values
15
+ 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
  user_input_clear = user_input
 
29
  # 47 1 168 87 120 80 2 1 1 1 1
30
  # 37 0 185 75 120 80 2 1 1 1 0
31
  return f"{round(predicted_result_scaled[0][0] * 100, 2)}%"
32
+
33
+
34
  def pomoch(age, gender, height, weight, ap_hi, ap_lo, cholesterol, gluc, smoke, alco, active):
35
  X = [int(age), gender, int(height), int(weight), int(ap_hi), int(ap_lo), float(cholesterol), float(gluc), smoke,
36
  alco, active]