File size: 1,717 Bytes
dd370c5 |
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
#!/usr/bin/env python3
"""
Climate Risk Assessment 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 Enhanced Climate Risk Assessment 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()
|