File size: 13,619 Bytes
feca201 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
import os
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import gradio as gr
current_dir = os.path.dirname(os.path.realpath(__file__))
data = pd.read_csv(os.path.join(current_dir, "data.csv"))
X_all = data.drop(["targets"], axis=1)
y_all = data["targets"]
num_test = 0.20
X_train, X_test, y_train, y_test = train_test_split(
X_all, y_all, test_size=num_test, random_state=23
)
clf = RandomForestClassifier()
clf.fit(X_train, y_train)
from joblib import dump, load
js = """
function createGradioAnimation() {
var containerlog = document.createElement('div');
containerlog.id = 'gradio-animation';
containerlog.style.fontSize = '2em';
containerlog.style.fontWeight = 'bold';
containerlog.style.textAlign = 'center';
containerlog.style.marginBottom = '50px';
var logo = document.createElement('img');
logo.src = 'https://data2innov.fr/build/img/data2innov_logo.svg'; // Replace with your logo URL
logo.style.width = '200px'; // Adjust the size of the logo
containerlog.appendChild(logo);
var textElement = document.createElement('span');
// Ajouter le texte entre les deux images
textElement.textContent = "L'IA au service de l'implantologie Pr. Zoubeir TOURKI "; // Remplacez par votre texte
containerlog.appendChild(textElement);
var logo2 = document.createElement('img');
logo2.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAABUFBMVEX////9/f3y8vIAitAAjdIAj9P4+v07qd8spt7///2s0O4bot211PBOreEAot4AkdTo6/TH0ugAmdhCjcphndO/2fGjzO11o9b5+PcAm9rJ3fLZ4O8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i+OOGAmzsY4HkBkmrP1+6fiIDzOFbi9syIyzFSN7bLTrQVS0Y08daUGkNDUYFNhkvPtRIyg+xKa6v1MERBXG04p8kimYzFjIBHM4foj8IZMwZUEksGJy3BCdhy9aiaEOmdB4IfKJFybVVIoZq0EDMpnUC1NqcFT9OdZISgy/ZrEwFjY3uAxfKBF71YxBZJnoOMwXuSjTOdk2VjzEJA1nWiMjAVr56pDh7OXkNxIyQw9hnxv5eAMxptDbQm+GZaOj66lClGUyphMZfZFwkUKj6qmlEBOO9QgI4lNwnUYxpnLgX6m+ZF5UmmESo5fD8SmGyfRrwIakj0mP1uhPxeCy93EaC4MqmxqlgMNB1zE7GTSpSBI69aj0Rg4yyr2+hz++AG4xGkE1Ap2mMIjAIIZYdgQiDp8Ks6EBpSFcbI8JZ4Z7q5jLhGEiMbjuIkTDTDLd+xj7WpExGOOjg/UjH0xVQuJwRg4ycggdcOCxgISoyqaGEXIiKXCgt7m46RDD7IlvG3Oc4h4DHeStqhNiuLq3izkcuqjh2JsGOeQyTDT+Fj5D8dD3w4k3n6dSJUic2MH3eyIC8ZtJRYYS3JxRCDrJND+4yik+nWSZ5IDHh05yppMMGHJAHcQZK7Covw83j6IihT2W2UuJXH/zAJITUxDO9obknq0S8KVmUyLfL0iSF3GRhdiozNgoPnYYBksmon244lQkkwDrhQ9jA+zgrxEnRmHMghlWOsK/NjHm+Eg6hQpJRt927DMp0hmPJcJhlgVbpiMvpeQi6Whij2XD4UQs7uxjp/5/JLs32h6snw4AAAAASUVORK5CYII='
logo2.style.width = '100px'; // Adjust the size of the logo
containerlog.appendChild(logo2);
containerlog.style.display = 'flex';
containerlog.style.flexWrap = 'wrap';
containerlog.style.justifyContent = 'space-between';
var container = document.createElement('div');
container.id = 'gradio-animation';
container.style.fontSize = '2em';
container.style.fontWeight = 'bold';
container.style.textAlign = 'center';
container.style.marginBottom = '50px';
var text = 'Cette appli est realisée dans le cadre du congrés ATEMO 1-2 mars 2024 à Monastir';
for (var i = 0; i < text.length; i++) {
(function(i){
setTimeout(function(){
var letter = document.createElement('span');
letter.style.opacity = '0';
letter.style.color='red'
letter.style.transition = 'opacity 0.5s';
letter.innerText = text[i];
container.appendChild(letter);
setTimeout(function() {
letter.style.opacity = '1';
}, 50);
}, i * 250);
})(i);
}
var gradioContainerlog = document.querySelector('.gradio-container');
gradioContainerlog.insertBefore(containerlog, gradioContainerlog.firstChild);
var gradioContainer = document.querySelector('.gradio-container');
gradioContainer.insertBefore(container, gradioContainer.firstChild);
return 'Animation created';
}
"""
#clf = load('filename.model')
#predictions = clf.predict(X_test)
def predict_survival(densites, diametres):
df = pd.DataFrame.from_dict(
{
"densites": [densites],
"diametres": [diametres]
}
)
if 300> densites or densites>2000 :
gr.Info("La densité doit être entre 300 et 2000 HU'")
return None
if 3> diametres or diametres>6 :
gr.Info("le diametre doit être entre 3 et 6 mm")
return None
pred = clf.predict_proba(df)[0]
return {"No": float(pred[0]), "Yes": float(pred[1])}
demo = gr.Interface(
predict_survival,
[
gr.Number(label="Densité 'entre 300 et 2000 HU'"),
gr.Number(label="Diametre 'entre 3 et 6 mm'")
],
"label",
examples=[
[700, 5],
[1500, 3],
[311, 5.2]
],
live=False,
js=js,
submit_btn="Prédire"
)
if __name__ == "__main__":
demo.launch(share=True)
|