File size: 923 Bytes
220d4a1
efc3a78
 
63269df
efc3a78
63269df
efc3a78
 
 
 
c81cd31
efc3a78
 
 
 
 
 
 
 
 
 
 
 
48284e5
efc3a78
 
 
 
 
48284e5
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
# 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()