| |
| """ |
| Fallback: Simple Gradio app without Docker complexity |
| """ |
|
|
| import gradio as gr |
| import os |
| import sys |
| from datetime import datetime |
|
|
| def test_basic(): |
| return f"✅ App is working! Python {sys.version_info.major}.{sys.version_info.minor}, Time: {datetime.now()}" |
|
|
| def test_environment(): |
| env_info = [] |
| env_info.append(f"Python version: {sys.version}") |
| env_info.append(f"Working directory: {os.getcwd()}") |
| env_info.append(f"Environment variables: {len(os.environ)} total") |
| |
| |
| important_vars = ['GRADIO_SERVER_NAME', 'PORT', 'SPACE_ID'] |
| for var in important_vars: |
| value = os.getenv(var, 'Not set') |
| env_info.append(f"{var}: {value}") |
| |
| return "\n".join(env_info) |
|
|
| |
| with gr.Blocks(title="ChatCal Test") as demo: |
| gr.Markdown("# 🧪 ChatCal Simple Test") |
| gr.Markdown("Testing basic Gradio functionality without Docker complexity") |
| |
| with gr.Row(): |
| test_btn = gr.Button("Test Basic Function") |
| basic_output = gr.Textbox(label="Basic Test") |
| |
| with gr.Row(): |
| env_btn = gr.Button("Check Environment") |
| env_output = gr.Textbox(label="Environment Info", lines=8) |
| |
| test_btn.click(test_basic, outputs=basic_output) |
| env_btn.click(test_environment, outputs=env_output) |
|
|
| if __name__ == "__main__": |
| print("=== SIMPLE GRADIO TEST ===") |
| print(f"Starting simple Gradio app at {datetime.now()}") |
| |
| demo.launch( |
| server_name="0.0.0.0", |
| server_port=7860, |
| show_error=True |
| ) |