Update app.py
Browse files52 unmodified lines53545556575859606162636465666768697071727374757652 unmodified linesif password != UPLOAD_SECRET:return df, "Incorrect password. Upload failed."new_df = pd.read_csv(file.name)columns_order = ["Model_Name", "Library", "TTFT", "Tokens-per-Second", "Token_Count","Input_Tokens", "Output_Tokens"]for col in columns_order:if col not in new_df.columns:new_df[col] = pd.NAnew_df = new_df[columns_order]df = pd.concat([df, new_df], ignore_index=True)filename = os.path.basename(file.name)destination = os.path.join(csv_folder_path, filename)shutil.copy(file.name, destination)return df, f"File '{filename}' uploaded and data added successfully!"def read_and_process_csv_files(folder_path):all_data = []52 unmodified lines53545556575859606162636465666768697071727374757677787980818252 unmodified linesif password != UPLOAD_SECRET:return df, "Incorrect password. Upload failed."try:# Read the uploaded filenew_df = pd.read_csv(file.name)columns_order = ["Model_Name", "Library", "TTFT", "Tokens-per-Second", "Token_Count","input_length", "output_length"]for col in columns_order:if col not in new_df.columns:new_df[col] = pd.NAnew_df = new_df[columns_order]# Append the new data to the existing DataFramedf = pd.concat([df, new_df], ignore_index=True)# Save the uploaded file to the CSV folderfilename = os.path.basename(file.name)destination = os.path.join(csv_folder_path, filename)file.save(destination)return df, f"File '{filename}' uploaded and data added successfully!"except Exception as e:return df, f"An error occurred: {str(e)}"def read_and_process_csv_files(folder_path):all_data = []
app.py+24-18