Tremeschin commited on
Commit
882f153
·
unverified ·
1 Parent(s): 3a8aaca

Try creating egl and vulkan icd loaders in python

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -4,8 +4,10 @@ import sys
4
 
5
  import spaces
6
 
 
 
7
  # Install latest git main code
8
- bool(os.getenv("SPACES_ZERO_GPU")) and subprocess.run((
9
  sys.executable, "-m", "pip", "install", "--upgrade",
10
  "git+https://github.com/BrokenSource/BrokenSource@main",
11
  "git+https://github.com/BrokenSource/ShaderFlow@main",
@@ -30,7 +32,20 @@ ESTIMATORS.update({
30
  })
31
 
32
  # -----------------------------------------------|
 
 
 
 
 
 
 
 
33
 
 
 
 
 
 
34
  from DepthFlow.Webui import DepthGradio
35
 
36
  DepthGradio().launch(
 
4
 
5
  import spaces
6
 
7
+ ZeroGPU = bool(os.getenv("SPACES_ZERO_GPU"))
8
+
9
  # Install latest git main code
10
+ ZeroGPU and subprocess.run((
11
  sys.executable, "-m", "pip", "install", "--upgrade",
12
  "git+https://github.com/BrokenSource/BrokenSource@main",
13
  "git+https://github.com/BrokenSource/ShaderFlow@main",
 
32
  })
33
 
34
  # -----------------------------------------------|
35
+ # Create Vulkan and EGL ICD loaders files
36
+
37
+ from pathlib import Path
38
+
39
+ if ZeroGPU:
40
+ egl_vendor = Path("/usr/share/glvnd/egl_vendor.d/10_nvidia.json")
41
+ egl_vendor.parent.mkdir(parents=True, exist_ok=True)
42
+ egl_vendor.write_text('{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_nvidia.so.0"}}')
43
 
44
+ vulkan_icd = Path("/usr/share/vulkan/icd.d/nvidia_icd.json")
45
+ vulkan_icd.parent.mkdir(parents=True, exist_ok=True)
46
+ vulkan_icd.write_text('{"file_format_version":"1.0.0","ICD":{"library_path":"libGLX_nvidia.so.0","api_version":"1.3"}}')
47
+
48
+ # -----------------------------------------------|
49
  from DepthFlow.Webui import DepthGradio
50
 
51
  DepthGradio().launch(