Spaces:
Running on Zero
Running on Zero
github-actions[bot] commited on
Commit ·
8f6d6c3
1
Parent(s): 9ce3b5f
Deploy from GitHub - 2026-01-21 03:49:17
Browse files
app.py
CHANGED
|
@@ -14,16 +14,21 @@ Based on Johnson et al. "Perceptual Losses for Real-Time Style Transfer"
|
|
| 14 |
https://arxiv.org/abs/1603.08155
|
| 15 |
"""
|
| 16 |
|
| 17 |
-
# Fix for gradio_client
|
| 18 |
-
# Gradio 5.
|
| 19 |
-
# We upgrade
|
| 20 |
import sys
|
| 21 |
import subprocess
|
| 22 |
try:
|
| 23 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "gradio-client>=1.
|
| 24 |
except Exception:
|
| 25 |
pass # Best effort - if it fails, continue anyway
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
import gradio as gr
|
| 28 |
import torch
|
| 29 |
import torch.nn as nn
|
|
|
|
| 14 |
https://arxiv.org/abs/1603.08155
|
| 15 |
"""
|
| 16 |
|
| 17 |
+
# Fix for gradio_client.cli module missing - MUST be before importing gradio
|
| 18 |
+
# Gradio 5.x installs an older gradio-client that doesn't have the cli module
|
| 19 |
+
# We upgrade gradio-client before importing gradio
|
| 20 |
import sys
|
| 21 |
import subprocess
|
| 22 |
try:
|
| 23 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "gradio-client>=1.10.0", "--quiet"])
|
| 24 |
except Exception:
|
| 25 |
pass # Best effort - if it fails, continue anyway
|
| 26 |
|
| 27 |
+
# Clear any cached gradio_client modules
|
| 28 |
+
for module in list(sys.modules.keys()):
|
| 29 |
+
if 'gradio' in module:
|
| 30 |
+
del sys.modules[module]
|
| 31 |
+
|
| 32 |
import gradio as gr
|
| 33 |
import torch
|
| 34 |
import torch.nn as nn
|