#!/usr/bin/env python3 """ Minimal test to identify what's causing initialization failure """ print("Starting minimal test...") try: import gradio as gr print("✅ Gradio imported successfully") except Exception as e: print(f"❌ Gradio import failed: {e}") exit(1) try: import os print("✅ Environment variables check...") openai_key = os.environ.get("OPENAI_API_KEY") if openai_key: print("✅ OPENAI_API_KEY found") else: print("❌ OPENAI_API_KEY not found") except Exception as e: print(f"❌ Environment check failed: {e}") try: import openai print("✅ OpenAI imported successfully") except Exception as e: print(f"❌ OpenAI import failed: {e}") def minimal_app(): print("Creating minimal Gradio app...") def simple_chat(message, history): return history + [["User: " + message, "Bot: Hello! This is a test response."]] with gr.Blocks(title="Minimal Test") as app: gr.Markdown("# Minimal Test App") chatbot = gr.Chatbot() msg = gr.Textbox(placeholder="Type a message...") msg.submit(simple_chat, [msg, chatbot], chatbot) return app if __name__ == "__main__": try: print("Building app...") app = minimal_app() print("✅ App built successfully") print("Launching app...") app.launch( server_name="0.0.0.0", server_port=7860, show_error=True, quiet=False ) print("✅ App launched successfully") except Exception as e: print(f"❌ App launch failed: {e}") import traceback traceback.print_exc()