Spaces:
Sleeping
Sleeping
File size: 686 Bytes
5bae84a 5e85898 5bae84a 5e85898 5bae84a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import os
import threading
import sys
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return "Lichess Bot Wrapper is running!"
def run_lichess_core():
# flush=True forces the log to print instantly on Hugging Face
print("Launching Lichess Bot process...", flush=True)
# The "-u" flag turns on unbuffered output for the main bot script
os.system("python3 -u lichess-bot.py")
if __name__ == "__main__":
# Runs the actual bot logic in a background loop
threading.Thread(target=run_lichess_core, daemon=True).start()
# Keeps Hugging Face happy by listening on the mandatory port
app.run(host="0.0.0.0", port=7860)
|