Update app.py
Browse files
app.py
CHANGED
|
@@ -70,9 +70,52 @@ def calcul(
|
|
| 70 |
print(f"Moyenne : {matha.trunc(r * 100) / 100}")
|
| 71 |
return matha.trunc(r * 100) / 100
|
| 72 |
|
| 73 |
-
def
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
app1 = gr.Interface(
|
| 78 |
fn=calcul,
|
|
@@ -93,8 +136,18 @@ app1 = gr.Interface(
|
|
| 93 |
)
|
| 94 |
|
| 95 |
app2 = gr.Interface(
|
| 96 |
-
fn=
|
| 97 |
-
inputs=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
outputs=gr.Textbox(),
|
| 99 |
description=description_r,
|
| 100 |
)
|
|
|
|
| 70 |
print(f"Moyenne : {matha.trunc(r * 100) / 100}")
|
| 71 |
return matha.trunc(r * 100) / 100
|
| 72 |
|
| 73 |
+
def calcul_td(
|
| 74 |
+
math, francais, physique, svt, philo, thea, anglais, hist, espagnol
|
| 75 |
+
):
|
| 76 |
+
math = math * 4
|
| 77 |
+
francais = francais * 3
|
| 78 |
+
physique = physique * 4
|
| 79 |
+
svt = svt * 4
|
| 80 |
+
philo = philo * 2
|
| 81 |
+
thea = thea * 3
|
| 82 |
+
anglais = anglais * 2
|
| 83 |
+
hist = hist * 3
|
| 84 |
+
espagnol = espagnol * 2
|
| 85 |
+
conduite = 14 * 1
|
| 86 |
+
|
| 87 |
+
# Collectez les données des matières dans un tableau
|
| 88 |
+
data = [
|
| 89 |
+
["Math", math/4],
|
| 90 |
+
["Français", francais/3],
|
| 91 |
+
["Physique", physique/4],
|
| 92 |
+
["SVT", svt/4],
|
| 93 |
+
["Philo", philo/2],
|
| 94 |
+
["Théâtre", thea/3],
|
| 95 |
+
["Histoire", hist/3],
|
| 96 |
+
["Anglais", anglais/2],
|
| 97 |
+
["Espagnol", espagnol/2],
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
# Affichez le tableau dans la console
|
| 101 |
+
print("Données des matières :")
|
| 102 |
+
print(tabulate(data, headers=["Matière", "Note"], tablefmt="fancy_grid"))
|
| 103 |
+
print() # Ligne vide pour la clarté
|
| 104 |
+
|
| 105 |
+
total = (
|
| 106 |
+
math
|
| 107 |
+
+ francais
|
| 108 |
+
+ physique
|
| 109 |
+
+ svt
|
| 110 |
+
+ philo
|
| 111 |
+
+ thea
|
| 112 |
+
+ hist
|
| 113 |
+
+ anglais
|
| 114 |
+
+ espagnol
|
| 115 |
+
)
|
| 116 |
+
r = total / 27
|
| 117 |
+
print(f"Moyenne : {matha.trunc(r * 100) / 100}")
|
| 118 |
+
return matha.trunc(r * 100) / 100
|
| 119 |
|
| 120 |
app1 = gr.Interface(
|
| 121 |
fn=calcul,
|
|
|
|
| 136 |
)
|
| 137 |
|
| 138 |
app2 = gr.Interface(
|
| 139 |
+
fn=calcul_td,
|
| 140 |
+
inputs=[
|
| 141 |
+
gr.Number(label="Math"),
|
| 142 |
+
gr.Number(label="Français"),
|
| 143 |
+
gr.Number(label="Physique"),
|
| 144 |
+
gr.Number(label="SVT"),
|
| 145 |
+
gr.Number(label="Philo"),
|
| 146 |
+
gr.Number(label="Théâtre"),
|
| 147 |
+
gr.Number(label="Histoire"),
|
| 148 |
+
gr.Number(label="Anglais"),
|
| 149 |
+
gr.Number(label="Espagnol"),
|
| 150 |
+
],
|
| 151 |
outputs=gr.Textbox(),
|
| 152 |
description=description_r,
|
| 153 |
)
|