Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5201caa
1
Parent(s):
aa859e9
force gradio upgrade
Browse files
app.py
CHANGED
@@ -1,3 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
import uuid
|
|
|
1 |
+
import subprocess
|
2 |
+
import sys
|
3 |
+
|
4 |
+
# Upgrade Gradio to version 5.5.0
|
5 |
+
def upgrade_gradio():
|
6 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==5.5.0"])
|
7 |
+
|
8 |
+
try:
|
9 |
+
import gradio
|
10 |
+
if gradio.__version__ != "5.5.0":
|
11 |
+
print(f"Upgrading Gradio from version {gradio.__version__} to 5.5.0...")
|
12 |
+
upgrade_gradio()
|
13 |
+
print("Gradio upgraded. Restarting the script...")
|
14 |
+
# Restart the script after upgrading
|
15 |
+
os.execv(sys.executable, [sys.executable] + sys.argv)
|
16 |
+
except ImportError:
|
17 |
+
print("Gradio not found. Installing Gradio 5.5.0...")
|
18 |
+
upgrade_gradio()
|
19 |
+
print("Gradio installed. Restarting the script...")
|
20 |
+
os.execv(sys.executable, [sys.executable] + sys.argv)
|
21 |
+
|
22 |
+
|
23 |
import os
|
24 |
import sys
|
25 |
import uuid
|