File size: 864 Bytes
733a08d | 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 | #!/bin/bash
# Copyright (c) 2024, I am your father.
# I am your father.
# Exit immediately if a command exits with a non-zero status.
set -e
# Start the Turnstile Solver in the background
echo "Starting Turnstile Solver..."
# The solver must be started from its own directory
(cd /app/Turnstile-Solver && python api_solver.py) &
SOLVER_PID=$!
echo "Turnstile Solver started with PID $SOLVER_PID"
# Wait a few seconds for the solver to initialize
# This is important because the solver might need to download browser components on first run
echo "Waiting for solver to initialize..."
sleep 15
# Start the FastAPI app in the foreground
echo "Starting FastAPI app..."
# The main app expects to be run from the root directory
# Use the PORT variable that Hugging Face provides, default to 7860 for spaces
exec uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860} |