cleanup: remove dead code and duplicate docs
- Remove session-ses_2f27.md (161KB raw session log) - Remove 49 ROOT_* duplicate files across REFERENCE/ - Remove 14 duplicate files between REFERENCE/ root and history/ - Remove asr_legacy.rs (dead code, replaced by asr.rs) - Remove src/core/worker/ (duplicate JobWorker) - Remove src/core/layers/ (empty directory) - Remove 4 .bak files in src/ - Remove 7 dead private methods in worker/processor.rs - Remove backup directory from git tracking
This commit is contained in:
@@ -4,7 +4,6 @@ Audio Taxonomy Processor (Hugging Face Transformers)
|
||||
職責:使用 AST 模型進行高精度音頻分類,並映射到業務分類。
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@@ -75,7 +74,7 @@ def map_to_taxonomy(predictions):
|
||||
|
||||
def run_audio_taxonomy(audio_path, chunk_sec=1.0, hop_sec=0.5):
|
||||
"""執行分類"""
|
||||
print(f"🔍 Loading AST model (MIT) from Hugging Face...")
|
||||
print("🔍 Loading AST model (MIT) from Hugging Face...")
|
||||
# 使用 Audio Spectrogram Transformer,準確率高且支援 MPS/CPU
|
||||
classifier = pipeline(
|
||||
"audio-classification",
|
||||
@@ -103,7 +102,7 @@ def run_audio_taxonomy(audio_path, chunk_sec=1.0, hop_sec=0.5):
|
||||
|
||||
if taxonomy:
|
||||
results.append({"timestamp": round(current, 1), "categories": taxonomy})
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass # 跳過錯誤片段
|
||||
|
||||
current += hop_sec
|
||||
@@ -132,6 +131,6 @@ if __name__ == "__main__":
|
||||
with open(OUTPUT_JSON, "w", encoding="utf-8") as f:
|
||||
json.dump({"audio_taxonomy": events}, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f"\n🎉 Classification Complete!")
|
||||
print("\n🎉 Classification Complete!")
|
||||
print(f"✅ Found {len(events)} tagged audio segments.")
|
||||
print(f"💾 Saved to {OUTPUT_JSON}")
|
||||
|
||||
Reference in New Issue
Block a user