Juan Leal commited on
Commit
6da933b
·
1 Parent(s): 5b03097

Added incase I need gradio, usually I run pinokio for this though

Browse files
Files changed (1) hide show
  1. start_gradio.sh +23 -0
start_gradio.sh ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/zsh
2
+
3
+ # Step 1: Set the environment variable and run the Python script in the background
4
+ export PYTORCH_ENABLE_MPS_FALLBACK=1
5
+ source venv/bin/activate # Activate the virtual environment
6
+
7
+ # Run the app.py in the background and capture any output that resembles an IP address
8
+ python app.py 2>&1 | tee output.log &
9
+
10
+ # Wait for the app to start and capture the URL from the log
11
+ while true; do
12
+ if grep -q "http://[0-9.:]\+" output.log; then
13
+ url=$(grep -o "http://[0-9.:]\+" output.log | head -n 1)
14
+ break
15
+ fi
16
+ sleep 1
17
+ done
18
+
19
+ # Step 2: Start a proxy with the captured URL
20
+ proxy start --uri="$url" --name="Local Sharing"
21
+
22
+ # Optional: Output the URL for reference
23
+ echo "Application is accessible at $url"