Spaces:
Sleeping
Sleeping
| import warnings | |
| from dotenv import load_dotenv | |
| # Load environment variables from .env file | |
| load_dotenv() | |
| # Import handlers and UI creator from modules | |
| from prediction import single_prediction | |
| from chatbot import process_chatbot_query_with_llm | |
| from ui import create_ui | |
| # Import API utilities for direct access if needed | |
| from api_utils import ( | |
| api_get_tide_level, | |
| api_get_tide_series, | |
| api_get_extremes_info, | |
| api_check_tide_alert, | |
| api_compare_stations, | |
| api_health_check | |
| ) | |
| if __name__ == "__main__": | |
| # Suppress warnings for a cleaner output | |
| warnings.filterwarnings('ignore') | |
| # Create the Gradio UI by passing the handlers to the UI generator | |
| demo = create_ui( | |
| prediction_handler=single_prediction, | |
| chatbot_handler=process_chatbot_query_with_llm | |
| ) | |
| # Launch the application | |
| # share=True creates a public link | |
| # server_name="0.0.0.0" allows external connections | |
| # server_port=7860 is the default Hugging Face Spaces port | |
| demo.launch( | |
| share=False, # Set to True for public sharing | |
| server_name="0.0.0.0", # For Hugging Face Spaces | |
| server_port=7860 # Default HF Spaces port | |
| ) | |
| # Alternative launch configurations: | |
| # For local development: | |
| # demo.launch(share=False) | |
| # For Hugging Face Spaces: | |
| # demo.launch(server_name="0.0.0.0", server_port=7860) | |
| # For public sharing with ngrok: | |
| # demo.launch(share=True) |