euler314 commited on
Commit
e298a03
·
verified ·
1 Parent(s): eb8c873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1314,13 +1314,16 @@ def create_interface():
1314
 
1315
  # Run the app
1316
  if __name__ == "__main__":
1317
- # Schedule background tasks
1318
- schedule.every().day.at("01:00").do(update_ibtracs_data)
1319
- schedule.every().day.at("00:00").do(lambda: update_oni_data() if should_update_oni() else None)
1320
- scheduler_thread = threading.Thread(target=run_schedule)
1321
- scheduler_thread.daemon = True
1322
- scheduler_thread.start()
 
 
 
1323
 
1324
  # Create and launch the Gradio interface
1325
  demo = create_interface()
1326
- demo.launch(server_name="127.0.0.1", server_port=7860)
 
1314
 
1315
  # Run the app
1316
  if __name__ == "__main__":
1317
+ # For Hugging Face, use a simpler version without threading
1318
+ DATA_PATH = os.path.dirname(os.path.abspath(__file__))
1319
+
1320
+ print(f"Using data path: {DATA_PATH}")
1321
+
1322
+ ONI_DATA_PATH = os.path.join(DATA_PATH, 'oni_data.csv')
1323
+ TYPHOON_DATA_PATH = os.path.join(DATA_PATH, 'processed_typhoon_data.csv')
1324
+ LOCAL_iBtrace_PATH = os.path.join(DATA_PATH, 'ibtracs.WP.list.v04r01.csv')
1325
+ CACHE_FILE = os.path.join(DATA_PATH, 'ibtracs_cache.pkl')
1326
 
1327
  # Create and launch the Gradio interface
1328
  demo = create_interface()
1329
+ demo.launch(share=True) # Use share=True for Hugging Face Spaces