Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ from cProfile import label
|
|
3 |
from joblib import load
|
4 |
|
5 |
import matplotlib.pyplot as plt
|
6 |
-
import skfuzzy as fuzz
|
7 |
import gradio as gr
|
8 |
import numpy as np
|
9 |
|
@@ -75,9 +74,6 @@ def greet(Age,Sex,CP,Trtbps,Chol,Fbs,Restecg,Thalachh,Oldpeak,Slp,Caa,Thall,Exng
|
|
75 |
kmeans = load('kmeans.model')
|
76 |
y_km = kmeans.predict(x_std)
|
77 |
|
78 |
-
neigh = load('neigh.model')
|
79 |
-
y_nb = neigh.predict(x_std)
|
80 |
-
|
81 |
tree = load('tree.model')
|
82 |
y_tree = tree.predict(x_std)
|
83 |
|
@@ -87,11 +83,7 @@ def greet(Age,Sex,CP,Trtbps,Chol,Fbs,Restecg,Thalachh,Oldpeak,Slp,Caa,Thall,Exng
|
|
87 |
forest = load('forest.model')
|
88 |
y_forest = forest.predict(X_test)
|
89 |
|
90 |
-
|
91 |
-
u, u0, d, jm, p, fpc = fuzz.cluster.cmeans_predict(x_std.T, cntr, 2, error=0.005, maxiter=1000)
|
92 |
-
y_fuzzy = np.argmax(u, axis=0)
|
93 |
-
|
94 |
-
r = [y_lr[0], y_fuzzy[0], y_km[0], y_nb[0], y_tree[0], y_bayes[0], y_forest[0]]
|
95 |
|
96 |
f = mode(r)
|
97 |
|
@@ -108,11 +100,14 @@ def greet(Age,Sex,CP,Trtbps,Chol,Fbs,Restecg,Thalachh,Oldpeak,Slp,Caa,Thall,Exng
|
|
108 |
|
109 |
|
110 |
interface = gr.Interface(
|
111 |
-
title = "HeartAttack prediction - UMG",
|
112 |
description = "<h3>The idea is to classify between 0 = less chance of heart attack and 1 = more chance of heart attack, according to the data provided by the user.</h3>"+
|
113 |
-
"<b>Models:</b> Logistic Regression,
|
114 |
-
"<br><b>Metrics:</b> Accuracy: 0.
|
115 |
-
article='Step-by-step on GitHub <a href="https://github.com/Adrian8aS/Machine-Learning-App-Gradio/blob/21246d9ba87859e9068369b89d48b4c6ee13dfe5/Proyecto%20integrador.ipynb"> notebook </a>
|
|
|
|
|
|
|
116 |
allow_flagging = "never",
|
117 |
fn = greet,
|
118 |
inputs = [
|
@@ -130,7 +125,9 @@ interface = gr.Interface(
|
|
130 |
gr.Radio([0, 1, 2, 3], label="Thalium Stress Test result"),
|
131 |
gr.Radio(["Yes", "No"], label="Exercise induced angina")
|
132 |
],
|
133 |
-
outputs = [gr.Text(label="Prediction"), 'plot', 'plot']
|
|
|
|
|
134 |
)
|
135 |
|
136 |
interface.launch(share = False)
|
|
|
3 |
from joblib import load
|
4 |
|
5 |
import matplotlib.pyplot as plt
|
|
|
6 |
import gradio as gr
|
7 |
import numpy as np
|
8 |
|
|
|
74 |
kmeans = load('kmeans.model')
|
75 |
y_km = kmeans.predict(x_std)
|
76 |
|
|
|
|
|
|
|
77 |
tree = load('tree.model')
|
78 |
y_tree = tree.predict(x_std)
|
79 |
|
|
|
83 |
forest = load('forest.model')
|
84 |
y_forest = forest.predict(X_test)
|
85 |
|
86 |
+
r = [y_lr[0], y_km[0], y_tree[0], y_bayes[0], y_forest[0]]
|
|
|
|
|
|
|
|
|
87 |
|
88 |
f = mode(r)
|
89 |
|
|
|
100 |
|
101 |
|
102 |
interface = gr.Interface(
|
103 |
+
title = "HeartAttack prediction - UMG <br> Project Coeur ❤",
|
104 |
description = "<h3>The idea is to classify between 0 = less chance of heart attack and 1 = more chance of heart attack, according to the data provided by the user.</h3>"+
|
105 |
+
"<b>Models:</b> Logistic Regression, K-means, Decision Trees, Naive Bayes and Random Forest"+
|
106 |
+
"<br><b>Metrics:</b> Accuracy: 0.82, Precision: 0.775, Recall: 0.939, F1 Score: 0.849 <br> <br><b>Please provide the requested data:</b>",
|
107 |
+
article='Step-by-step on GitHub <a href="https://github.com/Adrian8aS/Machine-Learning-App-Gradio/blob/21246d9ba87859e9068369b89d48b4c6ee13dfe5/Proyecto%20integrador.ipynb"> notebook </a> '+
|
108 |
+
'<br>Dashboard of our train data <a href="https://1drv.ms/x/s!At7E16oDTBiKktUagvJHHpF5CCoITA?e=fOLjUq"> here! </a> '+
|
109 |
+
'<br>Privacy Policy <a href="https://raw.githubusercontent.com/rulasvrdz/DataMining/main/Texto.txt"> here! </a> '+
|
110 |
+
"<br><br> ~ Project Coeur",
|
111 |
allow_flagging = "never",
|
112 |
fn = greet,
|
113 |
inputs = [
|
|
|
125 |
gr.Radio([0, 1, 2, 3], label="Thalium Stress Test result"),
|
126 |
gr.Radio(["Yes", "No"], label="Exercise induced angina")
|
127 |
],
|
128 |
+
outputs = [gr.Text(label="Prediction"), 'plot', 'plot'],
|
129 |
+
examples = [[41,"Female","Typical Angina",130,204,"False","Normal",172,1.4,2,0,2,"No"],
|
130 |
+
[45,"Male","Non-anginal Pain",110,264,"False","ST-T wave normality",132,0.2,1,0,3,"No"]]
|
131 |
)
|
132 |
|
133 |
interface.launch(share = False)
|