Spaces:
Sleeping
Sleeping
Michael Hu
commited on
Commit
·
621a9bf
1
Parent(s):
781eb5f
log level
Browse files
src/application/services/audio_processing_service.py
CHANGED
|
@@ -332,7 +332,7 @@ class AudioProcessingApplicationService:
|
|
| 332 |
|
| 333 |
try:
|
| 334 |
os.makedirs(temp_dir, exist_ok=True)
|
| 335 |
-
logger.
|
| 336 |
yield temp_dir
|
| 337 |
|
| 338 |
finally:
|
|
@@ -341,7 +341,7 @@ class AudioProcessingApplicationService:
|
|
| 341 |
try:
|
| 342 |
import shutil
|
| 343 |
shutil.rmtree(temp_dir, ignore_errors=True)
|
| 344 |
-
logger.
|
| 345 |
except Exception as e:
|
| 346 |
logger.warning(f"Failed to cleanup temp directory {temp_dir}: {e}")
|
| 347 |
|
|
@@ -384,7 +384,7 @@ class AudioProcessingApplicationService:
|
|
| 384 |
duration=0.0 # Would be calculated from actual file
|
| 385 |
)
|
| 386 |
|
| 387 |
-
logger.
|
| 388 |
return audio_content
|
| 389 |
|
| 390 |
except Exception as e:
|
|
@@ -412,7 +412,7 @@ class AudioProcessingApplicationService:
|
|
| 412 |
SpeechRecognitionException: If STT fails
|
| 413 |
"""
|
| 414 |
try:
|
| 415 |
-
logger.
|
| 416 |
|
| 417 |
# Get STT provider from container
|
| 418 |
stt_provider = self._container.get_stt_provider(model)
|
|
@@ -454,7 +454,7 @@ class AudioProcessingApplicationService:
|
|
| 454 |
TranslationFailedException: If translation fails
|
| 455 |
"""
|
| 456 |
try:
|
| 457 |
-
logger.
|
| 458 |
f"Starting translation: {source_language or 'auto'} -> {target_language} "
|
| 459 |
f"[correlation_id={correlation_id}]"
|
| 460 |
)
|
|
@@ -510,7 +510,7 @@ class AudioProcessingApplicationService:
|
|
| 510 |
SpeechSynthesisException: If TTS fails
|
| 511 |
"""
|
| 512 |
try:
|
| 513 |
-
logger.
|
| 514 |
f"Starting TTS with voice: {voice}, speed: {speed} "
|
| 515 |
f"[correlation_id={correlation_id}]"
|
| 516 |
)
|
|
@@ -582,7 +582,7 @@ class AudioProcessingApplicationService:
|
|
| 582 |
try:
|
| 583 |
if os.path.exists(file_path):
|
| 584 |
os.remove(file_path)
|
| 585 |
-
logger.
|
| 586 |
except Exception as e:
|
| 587 |
logger.warning(f"Failed to cleanup temp file {file_path}: {e}")
|
| 588 |
finally:
|
|
|
|
| 332 |
|
| 333 |
try:
|
| 334 |
os.makedirs(temp_dir, exist_ok=True)
|
| 335 |
+
logger.info(f"Created temporary directory: {temp_dir}")
|
| 336 |
yield temp_dir
|
| 337 |
|
| 338 |
finally:
|
|
|
|
| 341 |
try:
|
| 342 |
import shutil
|
| 343 |
shutil.rmtree(temp_dir, ignore_errors=True)
|
| 344 |
+
logger.info(f"Cleaned up temporary directory: {temp_dir}")
|
| 345 |
except Exception as e:
|
| 346 |
logger.warning(f"Failed to cleanup temp directory {temp_dir}: {e}")
|
| 347 |
|
|
|
|
| 384 |
duration=0.0 # Would be calculated from actual file
|
| 385 |
)
|
| 386 |
|
| 387 |
+
logger.info(f"Converted upload to AudioContent: {upload.filename}")
|
| 388 |
return audio_content
|
| 389 |
|
| 390 |
except Exception as e:
|
|
|
|
| 412 |
SpeechRecognitionException: If STT fails
|
| 413 |
"""
|
| 414 |
try:
|
| 415 |
+
logger.info(f"Starting STT with model: {model} [correlation_id={correlation_id}]")
|
| 416 |
|
| 417 |
# Get STT provider from container
|
| 418 |
stt_provider = self._container.get_stt_provider(model)
|
|
|
|
| 454 |
TranslationFailedException: If translation fails
|
| 455 |
"""
|
| 456 |
try:
|
| 457 |
+
logger.info(
|
| 458 |
f"Starting translation: {source_language or 'auto'} -> {target_language} "
|
| 459 |
f"[correlation_id={correlation_id}]"
|
| 460 |
)
|
|
|
|
| 510 |
SpeechSynthesisException: If TTS fails
|
| 511 |
"""
|
| 512 |
try:
|
| 513 |
+
logger.info(
|
| 514 |
f"Starting TTS with voice: {voice}, speed: {speed} "
|
| 515 |
f"[correlation_id={correlation_id}]"
|
| 516 |
)
|
|
|
|
| 582 |
try:
|
| 583 |
if os.path.exists(file_path):
|
| 584 |
os.remove(file_path)
|
| 585 |
+
logger.info(f"Cleaned up temp file: {file_path}")
|
| 586 |
except Exception as e:
|
| 587 |
logger.warning(f"Failed to cleanup temp file {file_path}: {e}")
|
| 588 |
finally:
|