|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
PORT=${GRADIO_SERVER_PORT:-7860} |
|
|
|
|
|
|
|
|
if lsof -Pi :$PORT -sTCP:LISTEN -t >/dev/null 2>&1 ; then |
|
|
echo "β οΈ Port $PORT is already in use!" |
|
|
echo "" |
|
|
echo "Options:" |
|
|
echo " 1. Use a different port: GRADIO_SERVER_PORT=7861 ./run.sh" |
|
|
echo " 2. Kill the existing process: kill \$(lsof -t -i:$PORT)" |
|
|
echo "" |
|
|
|
|
|
|
|
|
for try_port in {7861..7870}; do |
|
|
if ! lsof -Pi :$try_port -sTCP:LISTEN -t >/dev/null 2>&1 ; then |
|
|
echo "β
Found available port: $try_port" |
|
|
echo " Starting on port $try_port..." |
|
|
export GRADIO_SERVER_PORT=$try_port |
|
|
PORT=$try_port |
|
|
break |
|
|
fi |
|
|
done |
|
|
fi |
|
|
|
|
|
echo "π Starting Gradio UI on port $PORT..." |
|
|
echo " Access at: http://localhost:$PORT" |
|
|
echo "" |
|
|
|
|
|
python3 app.py |
|
|
|