Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1430,16 +1430,15 @@ if __name__ == "__main__":
|
|
1430 |
data = preprocess_data(oni_data, typhoon_data)
|
1431 |
max_wind_speed, min_pressure = calculate_max_wind_min_pressure(typhoon_data)
|
1432 |
|
1433 |
-
|
1434 |
-
# Schedule IBTrACS data update daily
|
1435 |
-
schedule.every().day.at("01:00").do(update_ibtracs_data)
|
1436 |
-
|
1437 |
-
# Schedule ONI data check daily, but only update on specified dates
|
1438 |
-
schedule.every().day.at("00:00").do(lambda: update_oni_data() if should_update_oni() else None)
|
1439 |
-
|
1440 |
-
# Run the scheduler in a separate thread
|
1441 |
scheduler_thread = threading.Thread(target=run_schedule)
|
|
|
1442 |
scheduler_thread.start()
|
1443 |
|
1444 |
-
|
1445 |
-
app.run_server(
|
|
|
|
|
|
|
|
|
|
|
|
1430 |
data = preprocess_data(oni_data, typhoon_data)
|
1431 |
max_wind_speed, min_pressure = calculate_max_wind_min_pressure(typhoon_data)
|
1432 |
|
1433 |
+
# Schedule updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1434 |
scheduler_thread = threading.Thread(target=run_schedule)
|
1435 |
+
scheduler_thread.daemon = True # Make the thread daemon so it doesn't block shutdown
|
1436 |
scheduler_thread.start()
|
1437 |
|
1438 |
+
# Run the server
|
1439 |
+
app.run_server(
|
1440 |
+
debug=False, # Set debug to False in production
|
1441 |
+
host='0.0.0.0', # Bind to all interfaces
|
1442 |
+
port=7860,
|
1443 |
+
use_reloader=False # Disable reloader to prevent duplicate processes
|
1444 |
+
)
|