File size: 2,775 Bytes
dec02de
 
c5aef3f
9411f00
 
 
 
c5aef3f
9411f00
 
 
4242565
 
9411f00
 
a3f7a86
9411f00
 
 
 
dec02de
 
 
9411f00
 
 
 
 
a3f7a86
9411f00
 
 
 
 
 
c5aef3f
 
2ca2d54
 
 
 
 
 
 
 
 
 
 
c5aef3f
 
 
 
 
 
 
9411f00
 
 
 
 
 
 
 
 
 
 
 
 
a3f7a86
c5aef3f
9411f00
 
799aa19
 
dec02de
9411f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dec02de
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
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
):
    math = math * 5
    francais = francais * 3
    physique = physique * 4
    svt = svt * 3
    philo = philo * 2
    documentation = documentation * 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/5],
        ["Français", francais/3],
        ["Physique", physique/4],
        ["SVT", svt/3],
        ["Philo", philo/2],
        ["Documentation", documentation/2],
        ["Théâtre", thea/3],
        ["Histoire", hist/3],
        ["Anglais", anglais/2],
        ["Espagnol", espagnol/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
        + conduite
    )
    r = total / 30
    print(f"Moyenne : {matha.trunc(r * 100) / 100}")
    return matha.trunc(r * 100) / 100

def cr(t):
    print(f"ho: {t}")
    return " ah.... "

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"),
    ],
    outputs=gr.Textbox(label="Moyenne"),
    description=description_c,
)

app2 = gr.Interface(
    fn=cr,
    inputs=gr.Textbox(),
    outputs=gr.Textbox(),
    description=description_r,
)

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

demo.launch()