BrushNetApi / start_gradio.sh
Juan Leal
Added incase I need gradio, usually I run pinokio for this though
6da933b
raw
history blame contribute delete
714 Bytes
#!/bin/zsh
# Step 1: Set the environment variable and run the Python script in the background
export PYTORCH_ENABLE_MPS_FALLBACK=1
source venv/bin/activate # Activate the virtual environment
# Run the app.py in the background and capture any output that resembles an IP address
python app.py 2>&1 | tee output.log &
# Wait for the app to start and capture the URL from the log
while true; do
if grep -q "http://[0-9.:]\+" output.log; then
url=$(grep -o "http://[0-9.:]\+" output.log | head -n 1)
break
fi
sleep 1
done
# Step 2: Start a proxy with the captured URL
proxy start --uri="$url" --name="Local Sharing"
# Optional: Output the URL for reference
echo "Application is accessible at $url"