added api for ai; got backend working

This commit is contained in:
2026-03-26 23:39:31 -06:00
parent 164b2f87d4
commit 4a857d8cbf
20 changed files with 1436 additions and 280 deletions

47
backend/audio_cleaner.py Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""
Audio cleaning operations using DeepFilterNet or FFmpeg fallback.
"""
import json
import sys
from pathlib import Path
# Add backend to path
sys.path.insert(0, str(Path(__file__).parent))
from services.audio_cleaner import clean_audio, is_deepfilter_available
def main():
if len(sys.argv) < 2:
print("Usage: python audio_cleaner.py <command> [args...]", file=sys.stderr)
sys.exit(1)
command = sys.argv[1]
try:
if command == "clean_audio":
if len(sys.argv) != 4:
print("Usage: python audio_cleaner.py clean_audio <input_path> <output_path>", file=sys.stderr)
sys.exit(1)
input_path = sys.argv[2]
output_path = sys.argv[3]
result = clean_audio(input_path, output_path)
print(json.dumps({"output_path": result}))
elif command == "is_deepfilter_available":
result = is_deepfilter_available()
print(json.dumps({"available": result}))
else:
print(f"Unknown command: {command}", file=sys.stderr)
sys.exit(1)
except Exception as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()