Spaces:
Sleeping
Sleeping
windows standard
Browse files253 unmodified lines254255256257258259260261262263264265266267268269270271272273274253 unmodified linesexisting = DatasetDict()print("π κΈ°μ‘΄ repo μμ β μλ‘ μμ±")# νμ¬ μ¬μ©μλ§ μ λ°μ΄νΈfor user_id, records in user_data_groups.items():try:df = pd.DataFrame(records)new_dataset = Dataset.from_pandas(df)if user_id in existing:# κΈ°μ‘΄ λ°μ΄ν°νλ μκ³Ό λ³ν©old_df = existing[user_id].to_pandas()merged = pd.concat([old_df, df], ignore_index=True)existing[user_id] = Dataset.from_pandas(merged)print(f"π {user_id}: κΈ°μ‘΄ λ°μ΄ν°μ λ³ν© ({len(old_df)} + {len(df)} = {len(merged)}κ° λ μ½λ)")else:existing[user_id] = new_datasetprint(f"π {user_id}: μ κ· λ°μ΄ν° μΆκ° ({len(df)}κ° λ μ½λ)")results[user_id] = {"status": "success",253 unmodified lines254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293253 unmodified linesexisting = DatasetDict()print("π κΈ°μ‘΄ repo μμ β μλ‘ μμ±")def normalize_windows(record):"""windows λ°μ΄ν°λ₯Ό λ¬Έμμ΄ λ¦¬μ€νΈλ‘ μ κ·ν"""w = record.get("windows")if isinstance(w, list):if len(w) > 0 and isinstance(w[0], dict):record["windows"] = [str(v) for d in w for v in d.values()]else:record["windows"] = [str(x) for x in w]elif isinstance(w, dict):record["windows"] = [str(v) for v in w.values()]else:record["windows"] = []return record# νμ¬ μ¬μ©μλ§ μ λ°μ΄νΈfor user_id, records in user_data_groups.items():try:# μ λ°μ΄ν° μ κ·νnormalized = [normalize_windows(r) for r in records]new_df = pd.DataFrame(normalized)new_dataset = Dataset.from_pandas(new_df)if user_id in existing:# κΈ°μ‘΄ λ°μ΄ν° μ κ·ν λ° λ³ν©old_df = existing[user_id].to_pandas()old_df["windows"] = old_df["windows"].apply(lambda w: [str(v) for v in w] if isinstance(w, list) else [])merged_df = pd.concat([old_df, new_df], ignore_index=True)existing[user_id] = Dataset.from_pandas(merged_df)print(f"π {user_id}: κΈ°μ‘΄ λ°μ΄ν°μ λ³ν© ({len(old_df)} + {len(new_df)} = {len(merged_df)}κ° λ μ½λ)")else:existing[user_id] = new_datasetprint(f"π {user_id}: μ κ· λ°μ΄ν° μΆκ° ({len(new_df)}κ° λ μ½λ)")results[user_id] = {"status": "success",
app.py+26-7