github-actions[bot] commited on
Commit
5de41f0
·
1 Parent(s): 37b20e3

Deploy from GitHub - 2026-01-21 10:19:27

Browse files
app.py CHANGED
@@ -1805,15 +1805,12 @@ custom_css = """
1805
  Gradio 5.x Compatible
1806
  ============================================ */
1807
 
1808
- /* Import Google Fonts */
1809
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
1810
-
1811
  /* Animated gradient background */
1812
  body {
1813
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
1814
  background-size: 400% 400%;
1815
  animation: gradientBG 15s ease infinite;
1816
- font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
1817
  min-height: 100vh;
1818
  }
1819
 
@@ -1825,7 +1822,7 @@ body {
1825
 
1826
  /* Universal font application */
1827
  * {
1828
- font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
1829
  }
1830
 
1831
  /* Ensure text elements are visible */
 
1805
  Gradio 5.x Compatible
1806
  ============================================ */
1807
 
 
 
 
1808
  /* Animated gradient background */
1809
  body {
1810
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
1811
  background-size: 400% 400%;
1812
  animation: gradientBG 15s ease infinite;
1813
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
1814
  min-height: 100vh;
1815
  }
1816
 
 
1822
 
1823
  /* Universal font application */
1824
  * {
1825
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
1826
  }
1827
 
1828
  /* Ensure text elements are visible */
kernels/__init__.py CHANGED
@@ -16,8 +16,13 @@ _FusedInstanceNorm2d = None
16
  _KERNELS_COMPILED = False
17
  _LOADED_KERNEL_FUNC = None
18
 
19
- # Check if running on ZeroGPU
20
- _ZERO_GPU = os.environ.get('SPACE_ID', '').startswith('hf.co') or os.environ.get('ZERO_GPU') == '1'
 
 
 
 
 
21
 
22
  # Path to pre-compiled kernels
23
  _PREBUILT_PATH = Path(__file__).parent / "prebuilt"
@@ -116,13 +121,15 @@ def load_prebuilt_kernels():
116
  kernel_files = list(kernels_dir.glob("*.so")) + list(kernels_dir.glob("*.pyd"))
117
  kernel_files += list(_PREBUILT_PATH.glob("*.so")) + list(_PREBUILT_PATH.glob("*.pyd"))
118
 
119
- # On HuggingFace Spaces, try downloading from dataset if not found locally
120
- if not kernel_files and _ZERO_GPU:
121
- print("No local pre-compiled kernels found. Trying HuggingFace dataset...")
122
- if _download_kernels_from_dataset():
123
- # Check again after download - look in kernels directory
124
- kernel_files = list(kernels_dir.glob("*.so")) + list(kernels_dir.glob("*.pyd"))
125
- kernel_files += list(_PREBUILT_PATH.glob("*.so")) + list(_PREBUILT_PATH.glob("*.pyd"))
 
 
126
 
127
  if not kernel_files:
128
  print("No pre-compiled kernels found")
 
16
  _KERNELS_COMPILED = False
17
  _LOADED_KERNEL_FUNC = None
18
 
19
+ # Check if running on ZeroGPU or HuggingFace Spaces
20
+ # Use the same detection as app.py - presence of spaces package
21
+ try:
22
+ from spaces import GPU
23
+ _ZERO_GPU = True
24
+ except ImportError:
25
+ _ZERO_GPU = False
26
 
27
  # Path to pre-compiled kernels
28
  _PREBUILT_PATH = Path(__file__).parent / "prebuilt"
 
121
  kernel_files = list(kernels_dir.glob("*.so")) + list(kernels_dir.glob("*.pyd"))
122
  kernel_files += list(_PREBUILT_PATH.glob("*.so")) + list(_PREBUILT_PATH.glob("*.pyd"))
123
 
124
+ # Try downloading from dataset if not found locally (on ZeroGPU or if CUDA available)
125
+ if not kernel_files:
126
+ print(f"No local pre-compiled kernels found. _ZERO_GPU={_ZERO_GPU}")
127
+ if _ZERO_GPU or torch.cuda.is_available():
128
+ print("Trying HuggingFace dataset...")
129
+ if _download_kernels_from_dataset():
130
+ # Check again after download - look in kernels directory
131
+ kernel_files = list(kernels_dir.glob("*.so")) + list(kernels_dir.glob("*.pyd"))
132
+ kernel_files += list(_PREBUILT_PATH.glob("*.so")) + list(_PREBUILT_PATH.glob("*.pyd"))
133
 
134
  if not kernel_files:
135
  print("No pre-compiled kernels found")
kernels/instance_norm_wrapper.py CHANGED
@@ -12,8 +12,12 @@ from pathlib import Path
12
  from typing import Optional
13
  import os
14
 
15
- # Check if running on ZeroGPU
16
- _ZERO_GPU = os.environ.get('SPACE_ID', '').startswith('hf.co') or os.environ.get('ZERO_GPU') == '1'
 
 
 
 
17
 
18
  # Import local build utilities (only if not on ZeroGPU)
19
  if not _ZERO_GPU:
 
12
  from typing import Optional
13
  import os
14
 
15
+ # Check if running on ZeroGPU - use same detection as app.py
16
+ try:
17
+ from spaces import GPU
18
+ _ZERO_GPU = True
19
+ except ImportError:
20
+ _ZERO_GPU = False
21
 
22
  # Import local build utilities (only if not on ZeroGPU)
23
  if not _ZERO_GPU: