Anupam202224 commited on
Commit
55b7970
1 Parent(s): 85f1529

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,7 +1,13 @@
 
 
 
1
  import pickle
2
  import gradio as gr
3
  import numpy as np
4
 
 
 
 
5
  # Load the trained model
6
  model = pickle.load(open('/content/heart_disease_model.sav', 'rb'))
7
 
@@ -9,7 +15,7 @@ model = pickle.load(open('/content/heart_disease_model.sav', 'rb'))
9
  def predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal):
10
  input_data = np.array([[age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]])
11
  prediction = model.predict(input_data)
12
-
13
  if prediction[0] == 1:
14
  return "The person has heart disease."
15
  else:
@@ -43,3 +49,6 @@ def heart_disease_interface():
43
 
44
  # Launch the Gradio Interface
45
  heart_disease_interface().launch()
 
 
 
 
1
+ import pandas as pd
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.linear_model import LogisticRegression
4
  import pickle
5
  import gradio as gr
6
  import numpy as np
7
 
8
+ # Load the CSV data
9
+ data = pd.read_csv('/content/Untitled spreadsheet - Heart desiese data.csv') # Ensure the correct file path
10
+
11
  # Load the trained model
12
  model = pickle.load(open('/content/heart_disease_model.sav', 'rb'))
13
 
 
15
  def predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal):
16
  input_data = np.array([[age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]])
17
  prediction = model.predict(input_data)
18
+
19
  if prediction[0] == 1:
20
  return "The person has heart disease."
21
  else:
 
49
 
50
  # Launch the Gradio Interface
51
  heart_disease_interface().launch()
52
+
53
+ # Check the first few rows of the data (optional)
54
+ print(data.head())