Spaces:
Runtime error
Runtime error
File size: 676 Bytes
d545106 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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 |