-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
30 lines (23 loc) · 923 Bytes
/
app.py
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
# AUTOGENERATED! DO NOT EDIT! File to edit: main.ipynb.
# %% auto 0
__all__ = ['analyse_fichier']
# %% main.ipynb 1
import gradio as gr
import pandas as pd
import tempfile
from pathlib import Path
from rbc import add_classements
def analyse_fichier(file):
fichier = file[0]
fichier_save = Path(fichier.name).stem
df_adherents = pd.read_excel(fichier)
df_classements = add_classements(df_adherents)
with tempfile.NamedTemporaryFile(prefix=fichier_save+'_', suffix=".xlsx", delete=False) as temp:
df_classements.to_excel(temp.name)
return temp.name
with gr.Blocks() as classement_converter:
file = gr.File(label="Adhérents", file_count=1)
greet_btn = gr.Button("Ajoute Classements")
outputs = gr.File(label="Adhérents avec classement", file_count=1, visible=True)
greet_btn.click(fn=analyse_fichier, inputs=file, outputs=outputs)
classement_converter.launch()