github-actions[bot] commited on
Commit
8f6d6c3
·
1 Parent(s): 9ce3b5f

Deploy from GitHub - 2026-01-21 03:49:17

Browse files
Files changed (1) hide show
  1. app.py +9 -4
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 boolean schema bug - MUST be before importing gradio
18
- # Gradio 5.12+ installs gradio-client==1.5.4 which has the bug
19
- # We upgrade to 1.8.0+ which fixes it, then import gradio
20
  import sys
21
  import subprocess
22
  try:
23
- subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "gradio-client>=1.8.0", "--quiet", "--no-deps"])
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