File size: 4,291 Bytes
dec02de
 
c5aef3f
9411f00
 
 
 
c5aef3f
9411f00
 
 
4242565
 
9411f00
 
a3f7a86
9411f00
 
 
 
dec02de
e6fe8a8
dec02de
9411f00
 
 
 
 
e6fe8a8
9411f00
 
 
 
e6fe8a8
9411f00
 
c5aef3f
 
2ca2d54
 
 
 
 
e6fe8a8
2ca2d54
 
 
 
e6fe8a8
2ca2d54
c5aef3f
 
 
 
 
 
 
9411f00
 
 
 
 
 
 
 
 
 
 
e6fe8a8
9411f00
 
e6fe8a8
c5aef3f
9411f00
 
771bb35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9411f00
 
 
 
 
 
 
 
 
 
 
 
 
 
ac2dd91
9411f00
 
 
 
 
 
771bb35
 
 
 
 
 
 
 
 
 
 
 
9411f00
 
 
 
dec02de
9411f00
52d4117
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import math as matha
import gradio as gr
from tabulate import tabulate  # Importez la bibliothèque tabulate

title_c = "Calculateur de moyenne !"
description_c = """Entrez vos notes pour chaque matière pour calculer votre moyenne.
Note : les coefficients de cette app sont adaptés à la classe de première S uniquement. Je ferais une mise à jour plus tard si j'ai le temps. 
la conduite est fixée à 14/20.
Et ici la virgule s'écrit avec le point.

Exemple : 12,5 devient 12.5

Juste la moyenne trimestrielle ohhhh pas plus. 
 
 en tout cas.........
 J'ai mis documentation 2 de coef
"""

description_r = """ En cours.... mais en vérité tout dépendra de mon humeur........ """

def calcul(
    math, francais, physique, svt, philo, documentation, thea, anglais, hist, espagnol,eps
):
    math = math * 5
    francais = francais * 3
    physique = physique * 4
    svt = svt * 3
    philo = philo * 2
    documentation = documentation * 1
    thea = thea * 3
    anglais = anglais * 2
    hist = hist * 3
    espagnol = espagnol * 2
    eps = eps * 2
    conduite = 14 * 1

    # Collectez les données des matières dans un tableau
    data = [
        ["Math", math/5],
        ["Français", francais/3],
        ["Physique", physique/4],
        ["SVT", svt/3],
        ["Philo", philo/2],
        ["Documentation", documentation/1],
        ["Théâtre", thea/3],
        ["Histoire", hist/3],
        ["Anglais", anglais/2],
        ["Espagnol", espagnol/2],
        ["Eps",eps/2],
        ["Conduite", conduite/1],
    ]

    # Affichez le tableau dans la console
    print("Données des matières :")
    print(tabulate(data, headers=["Matière", "Note"], tablefmt="fancy_grid"))
    print()  # Ligne vide pour la clarté

    total = (
        math
        + francais
        + physique
        + svt
        + philo
        + documentation
        + thea
        + hist
        + anglais
        + espagnol
        + eps
        + conduite
    )
    r = total / 31
    print(f"Moyenne : {matha.trunc(r * 100) / 100}")
    return matha.trunc(r * 100) / 100

def calcul_td(
    math, francais, physique, svt, philo, thea, anglais, hist, espagnol
):
    math = math * 4
    francais = francais * 3
    physique = physique * 4
    svt = svt * 4
    philo = philo * 2
    thea = thea * 3
    anglais = anglais * 2
    hist = hist * 3
    espagnol = espagnol * 2
    conduite = 14 * 1

    # Collectez les données des matières dans un tableau
    data = [
        ["Math", math/4],
        ["Français", francais/3],
        ["Physique", physique/4],
        ["SVT", svt/4],
        ["Philo", philo/2],
        ["Théâtre", thea/3],
        ["Histoire", hist/3],
        ["Anglais", anglais/2],
        ["Espagnol", espagnol/2],
    ]

    # Affichez le tableau dans la console
    print("Données des matières :")
    print(tabulate(data, headers=["Matière", "Note"], tablefmt="fancy_grid"))
    print()  # Ligne vide pour la clarté

    total = (
        math
        + francais
        + physique
        + svt
        + philo
        + thea
        + hist
        + anglais
        + espagnol
    )
    r = total / 27
    print(f"Moyenne : {matha.trunc(r * 100) / 100}")
    return matha.trunc(r * 100) / 100

app1 = gr.Interface(
    fn=calcul,
    inputs=[
        gr.Number(label="Math"),
        gr.Number(label="Français"),
        gr.Number(label="Physique"),
        gr.Number(label="SVT"),
        gr.Number(label="Philo"),
        gr.Number(label="Documentaion"),
        gr.Number(label="Théâtre"),
        gr.Number(label="Histoire"),
        gr.Number(label="Anglais"),
        gr.Number(label="Espagnol"),
        gr.Number(label="Eps")
    ],
    outputs=gr.Textbox(label="Moyenne"),
    description=description_c,
)

app2 = gr.Interface(
    fn=calcul_td, 
    inputs=[
        gr.Number(label="Math"),
        gr.Number(label="Français"),
        gr.Number(label="Physique"),
        gr.Number(label="SVT"),
        gr.Number(label="Philo"),
        gr.Number(label="Théâtre"),
        gr.Number(label="Histoire"),
        gr.Number(label="Anglais"),
        gr.Number(label="Espagnol"),
    ],
    outputs=gr.Textbox(),
    description=description_r,
)

demo = gr.TabbedInterface([app1, app2], ["Calcule-1ere S2 ", "Terminal A1"])

demo.launch()