Spaces:
Runtime error
Runtime error
File size: 1,254 Bytes
ee86994 b9ef50d ee86994 b9ef50d ee86994 b9ef50d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
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) |