import pandas as pd import gradio as gr def load_data_from_file(file_obj): try: df = pd.read_csv(file_obj.name, sep=";") if df.empty: gr.Warning("Le fichier CSV est vide.") return None, 0 required_cols = [f"{lm}_{axis}_mean" for lm in ["SHOULDER", "ELBOW", "WRIST", "INDEX", "THUMB"] for axis in ['X', 'Y', 'Z']] if not all(col in df.columns for col in required_cols): gr.Warning("Colonnes manquantes dans le fichier CSV.") return None, 0 return df, len(df) except Exception as e: gr.Error(f"Erreur de lecture CSV: {str(e)}") return None, 0