#!/usr/bin/env python3 """ CAVA Platform - Main Application """ from config import ( API_KEY, NASA_FIRMS_MAP_KEY, GRADIO_SERVER_NAME, GRADIO_SERVER_PORT, GRADIO_SHARE, model, ) from ui.ui import ClimateRiskUI def main(): """Main function to launch the application.""" # Check API key configuration if not API_KEY or API_KEY == "your-anthropic-api-key-here": print("⚠️ WARNING: ANTHROPIC_API_KEY not properly configured!") print(" Please add your API key to the .env file:") print(" ANTHROPIC_API_KEY=your-actual-api-key-here") print(" You can get one at: https://console.anthropic.com/") print("") else: print("✅ Anthropic API key loaded from .env file") if not NASA_FIRMS_MAP_KEY or NASA_FIRMS_MAP_KEY == "your-nasa-firms-api-key-here": print("ℹ️ NASA FIRMS API key not configured (optional)") print(" For wildfire data, add to .env: NASA_FIRMS_MAP_KEY=your-key") print("") else: print("✅ NASA FIRMS API key loaded from .env file") try: ui = ClimateRiskUI(model) app = ui.create_interface() print("🚀 Launching CAVA-AI Platform...") print(f"📱 Open your browser and go to: http://localhost:{GRADIO_SERVER_PORT}") print("") app.launch( server_name=GRADIO_SERVER_NAME, server_port=GRADIO_SERVER_PORT, share=GRADIO_SHARE, show_error=True, ) except Exception as e: print(f"❌ Launch error: {e}") import traceback traceback.print_exc() if __name__ == "__main__": main()