Spaces:
Runtime error
Runtime error
Download start_debug.py from kalyan9/HealthGuard-AI: direct link, hf CLI and curl.
- Browser
- Download file 2.02 kB
-
https://huggingface.co/spaces/kalyan9/HealthGuard-AI/resolve/main/start_debug.py
- Command line
-
hf download hf://spaces/kalyan9/HealthGuard-AI/start_debug.py
-
curl -L -o start_debug.py https://huggingface.co/spaces/kalyan9/HealthGuard-AI/resolve/main/start_debug.py
2.02 kB
| """ | |
| Startup script for HealthGuard-AI with debugging enabled. | |
| """ | |
| import os | |
| import sys | |
| import subprocess | |
| import signal | |
| import time | |
| def signal_handler(sig, frame): | |
| """Handle Ctrl+C gracefully.""" | |
| print('\nShutting down gracefully...') | |
| sys.exit(0) | |
| def main(): | |
| """Main function to start the application with debugging.""" | |
| print("HealthGuard-AI Debug Startup") | |
| print("=" * 30) | |
| # Set up signal handler for graceful shutdown | |
| signal.signal(signal.SIGINT, signal_handler) | |
| # Check if we're in the right directory | |
| if not os.path.exists('app.py'): | |
| print("Error: app.py not found in current directory") | |
| print("Please run this script from the HealthGuard-AI directory") | |
| sys.exit(1) | |
| # Print instructions | |
| print("Starting HealthGuard-AI with debugging enabled...") | |
| print("Access the application at: http://localhost:7860") | |
| print("Debug endpoints:") | |
| print(" - http://localhost:7860/debug/login-status") | |
| print(" - http://localhost:7860/debug/test-session") | |
| print(" - http://localhost:7860/debug/clear-session") | |
| print(" - http://localhost:7860/debug/user/<email>") | |
| print("\nPress Ctrl+C to stop the server") | |
| print("=" * 50) | |
| # Start the Flask application | |
| try: | |
| # Set environment variables if not already set | |
| if not os.getenv('FLASK_APP'): | |
| os.environ['FLASK_APP'] = 'app.py' | |
| if not os.getenv('FLASK_ENV'): | |
| os.environ['FLASK_ENV'] = 'development' | |
| # Run the Flask application | |
| subprocess.run([sys.executable, 'app.py'], check=True) | |
| except subprocess.CalledProcessError as e: | |
| print(f"Error running the application: {e}") | |
| sys.exit(1) | |
| except KeyboardInterrupt: | |
| print("\nApplication stopped by user") | |
| except Exception as e: | |
| print(f"Unexpected error: {e}") | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| main() |