Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
bc65435
1
Parent(s):
518b2a8
keep older gradio
Browse files
app.py
CHANGED
@@ -1,25 +1,3 @@
|
|
1 |
-
import subprocess
|
2 |
-
import sys
|
3 |
-
import importlib
|
4 |
-
|
5 |
-
# Upgrade Gradio to the desired version
|
6 |
-
def upgrade_gradio():
|
7 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==5.5.0"])
|
8 |
-
|
9 |
-
# Attempt to upgrade Gradio before importing it
|
10 |
-
try:
|
11 |
-
import gradio
|
12 |
-
if gradio.__version__ != "5.5.0":
|
13 |
-
print(f"Upgrading Gradio from version {gradio.__version__} to 5.5.0...")
|
14 |
-
upgrade_gradio()
|
15 |
-
importlib.reload(gradio) # Reload the gradio module to ensure the updated version is used
|
16 |
-
print("Gradio upgraded to 5.5.0.")
|
17 |
-
except ImportError:
|
18 |
-
print("Gradio not found. Installing Gradio 5.5.0...")
|
19 |
-
upgrade_gradio()
|
20 |
-
import gradio # Import Gradio after installation
|
21 |
-
print("Gradio installed and imported.")
|
22 |
-
|
23 |
import os
|
24 |
import sys
|
25 |
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
import uuid
|