Spaces:
Running
on
L40S
Running
on
L40S
| import gradio as gr | |
| import os | |
| import sys | |
| print("=== DEBUG: Starting minimal Gradio test ===") | |
| print(f"Python version: {sys.version}") | |
| print(f"Gradio version: {gr.__version__}") | |
| print(f"Working directory: {os.getcwd()}") | |
| print(f"PORT env var: {os.environ.get('PORT', 'Not set')}") | |
| def simple_function(text): | |
| return f"You entered: {text}" | |
| # Minimal interface | |
| with gr.Blocks(title="Debug Test") as demo: | |
| gr.Markdown("# Debug Test - If you see this, Gradio is working!") | |
| with gr.Row(): | |
| text_input = gr.Textbox(label="Test Input") | |
| text_output = gr.Textbox(label="Test Output") | |
| btn = gr.Button("Test") | |
| btn.click(simple_function, inputs=text_input, outputs=text_output) | |
| if __name__ == "__main__": | |
| port = int(os.environ.get("PORT", 7860)) | |
| print(f"=== Attempting to launch on 0.0.0.0:{port} ===") | |
| try: | |
| demo.launch( | |
| server_name="0.0.0.0", | |
| server_port=port, | |
| share=False, | |
| show_error=True | |
| ) | |
| print("=== Gradio launched successfully ===") | |
| except Exception as e: | |
| print(f"=== ERROR: Gradio failed to launch ===") | |
| print(f"Error: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| sys.exit(1) |