import asyncio from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") def home(): return {"status": "Lichess bot is running!"} async def run_lichess_bot(): print("Starting Lichess bot...") # --- YOUR COURSERA / LICHESS BOT CODE GOES HERE --- # Example: # while True: # await check_lichess_games() # await asyncio.sleep(1) pass @app.on_event("startup") async def startup_event(): # This fires off your chess bot in the background # so it doesn't block the web server from starting asyncio.create_task(run_lichess_bot()) if __name__ == "__main__": # Hugging Face strictly requires port 7860 uvicorn.run(app, host="0.0.0.0", port=7860)