commit e8bd1dbb41d4f6ab707d959fa2e1c91ca6711375 Author: BreizhHardware Date: Sun Mar 13 09:58:04 2022 +0100 first commit diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..17173d6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. + // Pointez pour afficher la description des attributs existants. + // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/assets/css/fronts/28DaysLater.woff b/assets/css/fronts/28DaysLater.woff new file mode 100644 index 0000000..0bc210f Binary files /dev/null and b/assets/css/fronts/28DaysLater.woff differ diff --git a/assets/css/fronts/28DaysLater.woff2 b/assets/css/fronts/28DaysLater.woff2 new file mode 100644 index 0000000..0e6e26e Binary files /dev/null and b/assets/css/fronts/28DaysLater.woff2 differ diff --git a/assets/css/fronts/ViaodaLibre-Regular.ttf b/assets/css/fronts/ViaodaLibre-Regular.ttf new file mode 100644 index 0000000..a152bc4 Binary files /dev/null and b/assets/css/fronts/ViaodaLibre-Regular.ttf differ diff --git a/assets/css/fronts/ViaodaLibre-Regular.woff2 b/assets/css/fronts/ViaodaLibre-Regular.woff2 new file mode 100644 index 0000000..7ea9dd7 Binary files /dev/null and b/assets/css/fronts/ViaodaLibre-Regular.woff2 differ diff --git a/assets/css/fronts/go3v2.ttf b/assets/css/fronts/go3v2.ttf new file mode 100644 index 0000000..23d266d Binary files /dev/null and b/assets/css/fronts/go3v2.ttf differ diff --git a/assets/css/fronts/go3v2.woff b/assets/css/fronts/go3v2.woff new file mode 100644 index 0000000..5b4bde9 Binary files /dev/null and b/assets/css/fronts/go3v2.woff differ diff --git a/assets/css/fronts/go3v2.woff2 b/assets/css/fronts/go3v2.woff2 new file mode 100644 index 0000000..a1805ed Binary files /dev/null and b/assets/css/fronts/go3v2.woff2 differ diff --git a/assets/css/fronts/viaodalibre-regular-webfont.woff b/assets/css/fronts/viaodalibre-regular-webfont.woff new file mode 100644 index 0000000..f10fdc7 Binary files /dev/null and b/assets/css/fronts/viaodalibre-regular-webfont.woff differ diff --git a/assets/css/fronts/viaodalibre-regular-webfont.woff2 b/assets/css/fronts/viaodalibre-regular-webfont.woff2 new file mode 100644 index 0000000..35081e3 Binary files /dev/null and b/assets/css/fronts/viaodalibre-regular-webfont.woff2 differ diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..94da41e --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,45 @@ +@font-face { + font-family: 'viaoda_libreregular'; + src: url('fronts/go3v2.woff2') format('woff2'), + url('fronts/go3v2.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +body { + background-image: -moz-linear-gradient(to right, #00ccff, #1900ff); + background-image: -webkit-linear-gradient(to right, #00ccff, #1900ff); + background-image: -ms-linear-gradient(to right, #00ccff, #1900ff); + background-image: linear-gradient(to right, #00ccff, #1900ff); +} +h1 { + font-family: 'viaoda_libreregular'; + font-weight: normal; + font-style: normal; + font-size: 60pt; + text-align: center ; +} + + +.center { + margin-left: auto ; + margin-right: auto ; +} + +p { + font-family: 'viaoda_libreregular'; + font-weight: normal; + font-size: 16pt; + font-style: normal; +} + +img { + display: block ; + width: 35% ; /* Les images occupent 35% de la largeur de la page */ +} + +/* Concerne la balise ...
*/ +table { + margin-top: 3em ; + margin-bottom: 3em ; +} \ No newline at end of file diff --git a/assets/css/style_iris.css b/assets/css/style_iris.css new file mode 100644 index 0000000..e242827 --- /dev/null +++ b/assets/css/style_iris.css @@ -0,0 +1,56 @@ +@font-face { + font-family: 'viaoda_libreregular'; + src: url('fronts/28DaysLater.woff2') format('woff2'), + url('fronts/28DaysLater.woff') format('woff'); + font-weight: normal; + font-style: normal; + } + + + body { + /*width: 1920px; + height: 1080px;*/ + background-image: url("../pic/monkey.jpg"); + background-size: cover; + background-repeat: no-repeat; + /*background-size: 1920px;*/ + } + h1 { + font-family: 'viaoda_libreregular'; + font-weight: normal; + font-style: normal; + font-size: 60pt; + text-align: center ; + } + + + .center { + margin-left: auto ; + margin-right: auto ; + } + + p { + font-family: 'viaoda_libreregular'; + font-weight: normal; + font-size: 20pt; + font-style: normal; + } + + li { + font-family: 'viaoda_libreregular'; + font-weight: normal; + font-size: 20pt; + font-style: normal; + } + + img { + position: absolute; + object-position: right; + width:30%; + height: auto; + } + + table { + margin-top: 3em ; + margin-bottom: 3em ; + } \ No newline at end of file diff --git a/assets/iris.csv b/assets/iris.csv new file mode 100644 index 0000000..b7f7460 --- /dev/null +++ b/assets/iris.csv @@ -0,0 +1,151 @@ +150,4,setosa,versicolor,virginica +5.1,3.5,1.4,0.2,0 +4.9,3.0,1.4,0.2,0 +4.7,3.2,1.3,0.2,0 +4.6,3.1,1.5,0.2,0 +5.0,3.6,1.4,0.2,0 +5.4,3.9,1.7,0.4,0 +4.6,3.4,1.4,0.3,0 +5.0,3.4,1.5,0.2,0 +4.4,2.9,1.4,0.2,0 +4.9,3.1,1.5,0.1,0 +5.4,3.7,1.5,0.2,0 +4.8,3.4,1.6,0.2,0 +4.8,3.0,1.4,0.1,0 +4.3,3.0,1.1,0.1,0 +5.8,4.0,1.2,0.2,0 +5.7,4.4,1.5,0.4,0 +5.4,3.9,1.3,0.4,0 +5.1,3.5,1.4,0.3,0 +5.7,3.8,1.7,0.3,0 +5.1,3.8,1.5,0.3,0 +5.4,3.4,1.7,0.2,0 +5.1,3.7,1.5,0.4,0 +4.6,3.6,1.0,0.2,0 +5.1,3.3,1.7,0.5,0 +4.8,3.4,1.9,0.2,0 +5.0,3.0,1.6,0.2,0 +5.0,3.4,1.6,0.4,0 +5.2,3.5,1.5,0.2,0 +5.2,3.4,1.4,0.2,0 +4.7,3.2,1.6,0.2,0 +4.8,3.1,1.6,0.2,0 +5.4,3.4,1.5,0.4,0 +5.2,4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.7,3.1,5.6,2.4,2 +6.9,3.1,5.1,2.3,2 +5.8,2.7,5.1,1.9,2 +6.8,3.2,5.9,2.3,2 +6.7,3.3,5.7,2.5,2 +6.7,3.0,5.2,2.3,2 +6.3,2.5,5.0,1.9,2 +6.5,3.0,5.2,2.0,2 +6.2,3.4,5.4,2.3,2 +5.9,3.0,5.1,1.8,2 diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..363983d --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,19 @@ +function checkFeatures() { + nbFeatures = 0 + if (document.forms["features"]["sepal-length"].value != '') { + nbFeatures = nbFeatures + 1 ; + } + if (document.forms["features"]["sepal-width"].value != '') { + nbFeatures = nbFeatures + 1 ; + } + if (document.forms["features"]["petal-length"].value != '') { + nbFeatures = nbFeatures + 1 ; + } + if (document.forms["features"]["petal-width"].value != '') { + nbFeatures = nbFeatures + 1 ; + } + if (nbFeatures < 2) { + alert("Waring: You need to put at least 2 characteristics."); + return false ; + } + } \ No newline at end of file diff --git a/assets/pic/Setosa.jpeg b/assets/pic/Setosa.jpeg new file mode 100644 index 0000000..34feda7 Binary files /dev/null and b/assets/pic/Setosa.jpeg differ diff --git a/assets/pic/Versicolor.jpeg b/assets/pic/Versicolor.jpeg new file mode 100644 index 0000000..a7b7152 Binary files /dev/null and b/assets/pic/Versicolor.jpeg differ diff --git a/assets/pic/Virginica.jpeg b/assets/pic/Virginica.jpeg new file mode 100644 index 0000000..198817e Binary files /dev/null and b/assets/pic/Virginica.jpeg differ diff --git a/assets/pic/monkey.jpg b/assets/pic/monkey.jpg new file mode 100644 index 0000000..ed0a183 Binary files /dev/null and b/assets/pic/monkey.jpg differ diff --git a/cgi-bin/__pycache__/knn.cpython-38.pyc b/cgi-bin/__pycache__/knn.cpython-38.pyc new file mode 100644 index 0000000..35b44fa Binary files /dev/null and b/cgi-bin/__pycache__/knn.cpython-38.pyc differ diff --git a/cgi-bin/iris.py b/cgi-bin/iris.py new file mode 100644 index 0000000..22e3625 --- /dev/null +++ b/cgi-bin/iris.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +from knn import * +import cgi +import cgitb + +L = [] +S = [] +K = [] +U = [] +cgitb.enable() + +irisFile = ("assets/iris.csv") + + +form = cgi.FieldStorage() # Renvoie les données du formulaire sous + # la forme d'un dictionnaire. +if 'sepal-length' in form: + sepalLength = float(form['sepal-length'].value) + L.append(sepalLength) + S.append("longueur des sépales") + K.append(0) + U.append(float(form['sepal-length'].value)) +if 'sepal-width' in form: + sepalWidth = float(form['sepal-width'].value) + L.append(sepalWidth) + S.append("largeure des sépales") + K.append(1) + U.append(float(form['sepal-width'].value)) +if 'petal-length' in form: + petalLength = float(form['petal-length'].value) + L.append(petalLength) + S.append("longueur des pépales") + K.append(2) + U.append(float(form['petal-length'].value)) +if 'petal-width' in form: + petalWidth = float(form['petal-width'].value) + L.append(petalWidth) + S.append("largeur des pépales") + K.append(3) + U.append(float(form['petal-width'].value)) + +if len(K) == 2: + nmb = (K[0], K[1]) +elif len(K) == 3: + nmb = (K[0], K[1], K[2]) +else: + nmb = (K[0], K[1], K[2], K[3]) + +if len(U) == 2: + meze = (U[0], U[1]) +elif len(U) == 3: + meze = (U[0], U[1], U[2]) +else: + meze = (U[0], U[1], U[2], U[3]) + +a = readPoints(irisFile, (nmb)) +prout = prediction(a, (meze), 5) + +if prout == 0: + espir = 'Setosa' +elif prout == 1: + espir = 'Versicolor' +else: + espir = 'Virginica' +a = len(L) +i= 0 +txt="" + +while i < a: + txt = txt + " \n" + i = i + 1 + + + +print (f''' + + + + + + Résultat + + +

Reconnaissance d'une iris

+ {txt} +

Il s'agit probablement de l'espèce {espir}

+
+ + ''') \ No newline at end of file diff --git a/cgi-bin/knn.py b/cgi-bin/knn.py new file mode 100644 index 0000000..33753f3 --- /dev/null +++ b/cgi-bin/knn.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +def readPoints(filename, indexes): + """ Renvoie les informations du fichier filename sous la forme + d'un dictionnaire dont + * une clé est un point + * la valeur associée est la classe d'appartenance du point. + + indexes : indices des attributs à récupérer. + """ + + p = '[' + fichier = open(filename, 'r') + iris = {} + + fichier.readline() + + for line in fichier: + line = line.split(',') + line[4] = line[4][0] #retire le \n + + for u in range(len(indexes)): + j = [float(line[indexes[u]]) for u in range(len(indexes))] + j = tuple(j) + iris[j] = line[4] + + + fichier.close() + + return iris + + + + +def dist(P1, P2): + """ Renvoie la distance entre les points P1 et P2. + P1 et P2 sont deux points dans un espace de dimension quelconque. + """ + + P = 0 + x = [] + for i in range(len(P1)): + x.append(float(P2[i]) - float(P1[i])) #on mesure chacune des longueurs (vecteur) + for i in (x): + P = P + i**2 #formule de module + P = P**0.5 # puissance 0.5 = racine carré + + return P + + + +def prediction(clsPoints, P, k): + """ Renvoie la classe d'appartenance du point en utilisant le + jeu de données clsPoints et en appliquant la méthode des + k plus proches voisins. + """ + D = clsPoints + fleur0 =0 + fleur1 =0 + fleur2 =0 + l = [] + D2 = {} + for i in D.keys(): + l.append(dist(i, P)) + D2[dist(i, P)] = i + liste = sorted(l) + + + for u in range(k): + if D[D2[liste[u]]] == '0': + fleur0 += 1 + elif D[D2[liste[u]]] == '1': + fleur1 += 1 + else: + fleur2 += 1 + + end = [fleur0, fleur1, fleur2] + + + if max(end) == fleur0: + return 0 + elif max(end) == fleur1: + return 1 + else: + return 2 diff --git a/index.html b/index.html new file mode 100644 index 0000000..d8fdf2b --- /dev/null +++ b/index.html @@ -0,0 +1,27 @@ + + + + + + + Famille Iris + + + +

Iris

+

il existe plusieurs fleus d'iris, ce site vous permet de déduire l'espèce en fonction des caractéristiques de l'espèces

+

il faut au minimum deux critères pour une recherche pertinente

+ +

longueur des sépales


+

largeur des sépales


+

longueur des pétales


+

largeur des pétales


+
+ +
+
+ + \ No newline at end of file diff --git a/iris.code-workspace b/iris.code-workspace new file mode 100644 index 0000000..876a149 --- /dev/null +++ b/iris.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/iris.html.dev b/iris.html.dev new file mode 100644 index 0000000..29a3b80 --- /dev/null +++ b/iris.html.dev @@ -0,0 +1,16 @@ + + + + + + Résultat + + +

Reconnaissance d'une iris

+
+ +

Il s'agit probablement de l'espèce $espèce$

+
+ + \ No newline at end of file