mrcryptsie commited on
Commit
9889fd4
·
1 Parent(s): aadd23b
__pycache__/coefficients.cpython-313.pyc ADDED
Binary file (1.04 kB). View file
 
__pycache__/data.cpython-313.pyc ADDED
Binary file (9.7 kB). View file
 
__pycache__/debouche.cpython-313.pyc ADDED
Binary file (1.21 kB). View file
 
__pycache__/etablissement.cpython-313.pyc ADDED
Binary file (1.03 kB). View file
 
__pycache__/filiere.cpython-313.pyc ADDED
Binary file (1.67 kB). View file
 
__pycache__/student.cpython-313.pyc ADDED
Binary file (1.9 kB). View file
 
__pycache__/universite.cpython-313.pyc ADDED
Binary file (996 Bytes). View file
 
__pycache__/utils.cpython-313.pyc ADDED
Binary file (4.21 kB). View file
 
app.py CHANGED
@@ -14,7 +14,7 @@ def analyser_etudiant(student_id):
14
  # Vérifier si l'étudiant existe
15
  student = get_student_by_id(students, student_id)
16
  if not student:
17
- return ["Étudiant introuvable"] + [""] * 14 # Retourner 15 valeurs vides si l'étudiant n'est pas trouvé
18
 
19
  # Définir les coefficients et les biais
20
  coefficients = coefficients_C if student.serie == "C" else coefficients_D
@@ -29,19 +29,19 @@ def analyser_etudiant(student_id):
29
 
30
  # Étape 1 : Calcul des moyennes (hors Baccalauréat)
31
  moyennes = calculer_moyennes(student.resultats)
32
- moyennes_seconde = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes["Seconde"].items()])
33
- moyennes_premiere = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes["Première"].items()])
34
- moyennes_terminale = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes["Terminale"].items()])
35
 
36
  # Étape 2 : Calcul des scores (hors Baccalauréat)
37
  scores = calculer_scores_selection(moyennes, coefficients, biais)
38
- scores_seconde = "\n".join([f"- {matiere}: {score}" for matiere, score in scores["Seconde"].items()])
39
- scores_premiere = "\n".join([f"- {matiere}: {score}" for matiere, score in scores["Première"].items()])
40
- scores_terminale = "\n".join([f"- {matiere}: {score}" for matiere, score in scores["Terminale"].items()])
41
 
42
  # Étape 3 : Calcul des scores pour le Baccalauréat
43
  scores_bac = {}
44
- for matiere, note in student.resultats["Baccalauréat"].items():
45
  coef = coefficients.get_coefficient(matiere)
46
  score_bac = (note * coef) + note + biais.get(matiere, 0)
47
  scores_bac[matiere] = score_bac
@@ -80,6 +80,7 @@ def analyser_etudiant(student_id):
80
  top_matieres_str, # Quatre meilleures matières
81
  propositions_str # Filières proposées
82
  ]
 
83
  # Interface Gradio stylisée avec années séparées
84
  with gr.Blocks(theme=gr.themes.Soft()) as interface:
85
  gr.Markdown("# 🎓 Analyse des Étudiants et Suggestions de Filières 🎓")
@@ -159,4 +160,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as interface:
159
 
160
  # Lancer l'application
161
  if __name__ == "__main__":
162
- interface.launch()
 
14
  # Vérifier si l'étudiant existe
15
  student = get_student_by_id(students, student_id)
16
  if not student:
17
+ return ["Étudiant introuvable"] + ["N/A"] * 14 # Retourner des valeurs par défaut pour chaque champ
18
 
19
  # Définir les coefficients et les biais
20
  coefficients = coefficients_C if student.serie == "C" else coefficients_D
 
29
 
30
  # Étape 1 : Calcul des moyennes (hors Baccalauréat)
31
  moyennes = calculer_moyennes(student.resultats)
32
+ moyennes_seconde = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes.get("Seconde", {}).items()])
33
+ moyennes_premiere = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes.get("Première", {}).items()])
34
+ moyennes_terminale = "\n".join([f"- {matiere}: {moyenne}" for matiere, moyenne in moyennes.get("Terminale", {}).items()])
35
 
36
  # Étape 2 : Calcul des scores (hors Baccalauréat)
37
  scores = calculer_scores_selection(moyennes, coefficients, biais)
38
+ scores_seconde = "\n".join([f"- {matiere}: {score}" for matiere, score in scores.get("Seconde", {}).items()])
39
+ scores_premiere = "\n".join([f"- {matiere}: {score}" for matiere, score in scores.get("Première", {}).items()])
40
+ scores_terminale = "\n".join([f"- {matiere}: {score}" for matiere, score in scores.get("Terminale", {}).items()])
41
 
42
  # Étape 3 : Calcul des scores pour le Baccalauréat
43
  scores_bac = {}
44
+ for matiere, note in student.resultats.get("Baccalauréat", {}).items():
45
  coef = coefficients.get_coefficient(matiere)
46
  score_bac = (note * coef) + note + biais.get(matiere, 0)
47
  scores_bac[matiere] = score_bac
 
80
  top_matieres_str, # Quatre meilleures matières
81
  propositions_str # Filières proposées
82
  ]
83
+
84
  # Interface Gradio stylisée avec années séparées
85
  with gr.Blocks(theme=gr.themes.Soft()) as interface:
86
  gr.Markdown("# 🎓 Analyse des Étudiants et Suggestions de Filières 🎓")
 
160
 
161
  # Lancer l'application
162
  if __name__ == "__main__":
163
+ interface.launch(server_port=7860) # Spécifier un port pour éviter les conflits