Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,12 +6,10 @@ from sklearn.preprocessing import StandardScaler
|
|
| 6 |
from sklearn.metrics import accuracy_score
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
-
# Example dataset (replace with actual dataset)
|
| 10 |
# Load dataset
|
| 11 |
-
#df = pd.read_csv('heart.csv')
|
| 12 |
-
|
| 13 |
df = pd.read_csv("hf://datasets/buio/heart-disease/heart.csv")
|
| 14 |
|
|
|
|
| 15 |
X = df.drop('target', axis=1)
|
| 16 |
y = df['target']
|
| 17 |
|
|
@@ -40,10 +38,7 @@ def predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, e
|
|
| 40 |
|
| 41 |
# Make prediction
|
| 42 |
prediction = model.predict(input_data)
|
| 43 |
-
if prediction[0] == 1
|
| 44 |
-
return "The person has heart disease."
|
| 45 |
-
else:
|
| 46 |
-
return "The person does not have heart disease."
|
| 47 |
|
| 48 |
# Gradio integration
|
| 49 |
def gradio_predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal):
|
|
|
|
| 6 |
from sklearn.metrics import accuracy_score
|
| 7 |
import gradio as gr
|
| 8 |
|
|
|
|
| 9 |
# Load dataset
|
|
|
|
|
|
|
| 10 |
df = pd.read_csv("hf://datasets/buio/heart-disease/heart.csv")
|
| 11 |
|
| 12 |
+
# Define features and target
|
| 13 |
X = df.drop('target', axis=1)
|
| 14 |
y = df['target']
|
| 15 |
|
|
|
|
| 38 |
|
| 39 |
# Make prediction
|
| 40 |
prediction = model.predict(input_data)
|
| 41 |
+
return "The person has heart disease." if prediction[0] == 1 else "The person does not have heart disease."
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# Gradio integration
|
| 44 |
def gradio_predict_heart_disease(age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal):
|