Spaces:
Runtime error
Runtime error
File size: 984 Bytes
efc3a78 |
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 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../main.ipynb.
# %% auto 0
__all__ = ['analyse_fichier']
# %% ../main.ipynb 2
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
print(fichier_save)
df_adherents = pd.read_excel(fichier)
df_classements = add_classements(df_adherents)
with tempfile.NamedTemporaryFile(prefix=fichier_save+'_', suffix=".xlsx", delete=False) as temp:
print(temp.name)
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()
|