stt-gpu-service / FIXES_SUMMARY.md
Peter Michael Gits
fix: Completely resolve logging conflicts and Gradio API issues
95912ff

A newer version of the Gradio SDK is available: 6.12.0

Upgrade

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 using print()

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=True from 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=ignore to suppress all warnings
  • Added exception handling around logger setup to prevent any setup failures
  • Used flush=True in 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:

  1. βœ… Start without logging stream conflicts
  2. βœ… Launch Gradio interface without API errors
  3. βœ… Work properly in ZeroGPU environment
  4. βœ… Maintain all existing functionality
  5. βœ… Provide clear status output via print statements

Testing

Run the service and verify:

  • No ValueError: I/O operation on closed file errors
  • No TypeError: enable_queue errors
  • Service starts successfully on port 7860
  • All transcription functions work as expected