36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
import logging
|
|
|
|
# Ensure project root is in path
|
|
sys.path.append(r"d:\dsWork\aiData")
|
|
from Util.ASRClient import ASRClient
|
|
|
|
# Configure logging
|
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', stream=sys.stdout)
|
|
logger = logging.getLogger("DebugASR")
|
|
|
|
def debug():
|
|
file_path = r"d:\dsWork\aiData\DouYin\Audios\政策深度解读:取消行政分时电价,为何是电力市场化的灵魂一步 #新能源 #综合能碳 #电力市场 #马哥能源频道_1589c43b.mp3"
|
|
|
|
logger.info(f"Testing ASRClient with file: {file_path}")
|
|
|
|
try:
|
|
client = ASRClient()
|
|
text = client.transcribe_file_sync(file_path)
|
|
|
|
if text:
|
|
logger.info("Transcription successful!")
|
|
logger.info(f"Length: {len(text)}")
|
|
output_path = r"d:\dsWork\aiData\DouYin\Transcripts\debug_output.txt"
|
|
with open(output_path, 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
else:
|
|
logger.error("Transcription returned None")
|
|
|
|
except Exception as e:
|
|
logger.error(f"Fatal error: {str(e)}", exc_info=True)
|
|
|
|
if __name__ == "__main__":
|
|
debug()
|