Toowired's picture
Debug: Minimal app to isolate build errors
9e1d67e verified
Raw
History Blame Contribute Delete
2.38 kB
#!/usr/bin/env python3
"""
Minimal TTS Gradio App - Build Error Debug Version
Generated by Copilot
This is a simplified version to debug build errors
"""
import gradio as gr
import os
import logging
from datetime import datetime
# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def text_to_speech_basic(text, voice="en-US-AriaNeural"):
"""Basic TTS function for testing"""
if not text:
return None, "Please enter some text."
logger.info(f"TTS request: {text[:50]}...")
# For now, just return a success message
message = f"TTS processed: '{text[:50]}...' with voice {voice}"
return None, message
def create_gradio_app():
"""Create the Gradio interface"""
with gr.Blocks(title="TTS Debug App", theme=gr.themes.Soft()) as app:
gr.Markdown("# 🗣️ Text-to-Speech Debug App")
gr.Markdown("Minimal version to test build process")
with gr.Row():
with gr.Column():
text_input = gr.Textbox(
label="Text to Convert",
placeholder="Enter text here...",
lines=3
)
voice_dropdown = gr.Dropdown(
choices=["en-US-AriaNeural", "en-US-JennyNeural"],
value="en-US-AriaNeural",
label="Voice Selection"
)
convert_btn = gr.Button("Convert to Speech", variant="primary")
with gr.Column():
audio_output = gr.Audio(label="Generated Audio")
status_output = gr.Textbox(label="Status", lines=2)
# Event handlers
convert_btn.click(
fn=text_to_speech_basic,
inputs=[text_input, voice_dropdown],
outputs=[audio_output, status_output]
)
return app
def main():
"""Main function"""
logger.info("🚀 Starting TTS Debug App...")
app = create_gradio_app()
# Launch with minimal configuration
app.launch(
server_name="0.0.0.0",
server_port=7860,
show_error=True
)
if __name__ == "__main__":
main()