Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.12.0
STT Service Fixes Summary
Issues Resolved
1. Logging Conflicts (ValueError: I/O operation on closed file)
Problem: The ZeroGPU/Gradio environment was causing logging stream conflicts with httpx, uvicorn, and other libraries trying to write to closed file descriptors.
Solution: Completely disabled the Python logging module and replaced all logging with simple print statements:
- Added
logging.disable(logging.CRITICAL)to disable all logging - Disabled specific library loggers (httpx, gradio, uvicorn, transformers, torch, etc.)
- Removed all logging handlers from root logger
- Replaced complex logging setup with simple
safe_log()function usingprint()
2. Gradio API Compatibility (TypeError: enable_queue parameter)
Problem: The enable_queue=True parameter is deprecated in newer Gradio versions and causes a TypeError.
Solution: Removed the deprecated parameter from iface.launch():
- Removed
enable_queue=Truefrom launch parameters - Kept only compatible parameters:
server_name,server_port,share,show_error,quiet,max_threads
3. Additional Hardening
Enhancements made for bulletproof operation:
- Added environment variables to disable Gradio analytics and flagging
- Set
PYTHONWARNINGS=ignoreto suppress all warnings - Added exception handling around logger setup to prevent any setup failures
- Used
flush=Truein print statements for immediate output
Files Modified
/stt-gpu-service/app.py- Main application file with logging and API fixes/stt-gpu-service/test_fixes.py- Test script to verify fixes work/stt-gpu-service/FIXES_SUMMARY.md- This documentation
Key Changes Made
# BEFORE: Complex logging setup that caused conflicts
def setup_zerogpu_logging():
# Complex logging configuration...
# AFTER: Simple print-based logging
def safe_log(level, message):
print(f"[STT-{level.upper()}] {message}", flush=True)
# BEFORE: Deprecated Gradio parameters
iface.launch(
enable_queue=True, # β DEPRECATED
# other params...
)
# AFTER: Compatible parameters only
iface.launch(
server_name="0.0.0.0",
server_port=7860,
share=False,
show_error=True,
quiet=True,
max_threads=4 # β
COMPATIBLE
)
Expected Results
After these fixes, the STT service should:
- β Start without logging stream conflicts
- β Launch Gradio interface without API errors
- β Work properly in ZeroGPU environment
- β Maintain all existing functionality
- β Provide clear status output via print statements
Testing
Run the service and verify:
- No
ValueError: I/O operation on closed fileerrors - No
TypeError: enable_queueerrors - Service starts successfully on port 7860
- All transcription functions work as expected