Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,10 +9,20 @@ from prediction import single_prediction
|
|
| 9 |
from chatbot import process_chatbot_query_with_llm
|
| 10 |
from ui import create_ui
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
if __name__ == "__main__":
|
| 13 |
# Suppress warnings for a cleaner output
|
| 14 |
warnings.filterwarnings('ignore')
|
| 15 |
-
|
| 16 |
# Create the Gradio UI by passing the handlers to the UI generator
|
| 17 |
demo = create_ui(
|
| 18 |
prediction_handler=single_prediction,
|
|
@@ -20,4 +30,21 @@ if __name__ == "__main__":
|
|
| 20 |
)
|
| 21 |
|
| 22 |
# Launch the application
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from chatbot import process_chatbot_query_with_llm
|
| 10 |
from ui import create_ui
|
| 11 |
|
| 12 |
+
# Import API utilities for direct access if needed
|
| 13 |
+
from api_utils import (
|
| 14 |
+
api_get_tide_level,
|
| 15 |
+
api_get_tide_series,
|
| 16 |
+
api_get_extremes_info,
|
| 17 |
+
api_check_tide_alert,
|
| 18 |
+
api_compare_stations,
|
| 19 |
+
api_health_check
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
if __name__ == "__main__":
|
| 23 |
# Suppress warnings for a cleaner output
|
| 24 |
warnings.filterwarnings('ignore')
|
| 25 |
+
|
| 26 |
# Create the Gradio UI by passing the handlers to the UI generator
|
| 27 |
demo = create_ui(
|
| 28 |
prediction_handler=single_prediction,
|
|
|
|
| 30 |
)
|
| 31 |
|
| 32 |
# Launch the application
|
| 33 |
+
# share=True creates a public link
|
| 34 |
+
# server_name="0.0.0.0" allows external connections
|
| 35 |
+
# server_port=7860 is the default Hugging Face Spaces port
|
| 36 |
+
demo.launch(
|
| 37 |
+
share=False, # Set to True for public sharing
|
| 38 |
+
server_name="0.0.0.0", # For Hugging Face Spaces
|
| 39 |
+
server_port=7860 # Default HF Spaces port
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Alternative launch configurations:
|
| 43 |
+
# For local development:
|
| 44 |
+
# demo.launch(share=False)
|
| 45 |
+
|
| 46 |
+
# For Hugging Face Spaces:
|
| 47 |
+
# demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 48 |
+
|
| 49 |
+
# For public sharing with ngrok:
|
| 50 |
+
# demo.launch(share=True)
|