#!/usr/bin/env python3 """ AI Newsletter Generator - Hugging Face Spaces Entry Point This file serves as an alternative entry point for Hugging Face Spaces. The main application is in backend/main.py and runs via uvicorn. """ import subprocess import sys import os def main(): """Start the FastAPI application for Hugging Face Spaces""" # Set default port for Hugging Face Spaces port = os.getenv("PORT", "7860") # Command to start the FastAPI app cmd = [ sys.executable, "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", port ] print(f"Starting AI Newsletter Generator on port {port}...") print(f"Command: {' '.join(cmd)}") try: subprocess.run(cmd, check=True) except KeyboardInterrupt: print("\nShutting down...") except subprocess.CalledProcessError as e: print(f"Error starting application: {e}") sys.exit(1) if __name__ == "__main__": main()