udayl commited on
Commit
c95e3d2
·
1 Parent(s): 12bcf5b
Files changed (1) hide show
  1. gradio_app.py +32 -0
gradio_app.py CHANGED
@@ -23,6 +23,21 @@ from notebook_lm_kokoro import (
23
  KPipeline,
24
  )
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  # Set cache dirs BEFORE importing torch, transformers, or moshi
27
  os.environ["HF_HOME"] = "/tmp/huggingface"
28
  os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
@@ -33,6 +48,23 @@ os.environ["MOSHI_CACHE_DIR"] = "/tmp/moshi"
33
  # Explicitly override ~/.cache
34
  os.environ["HOME"] = "/tmp/home"
35
  os.makedirs("/tmp/home", exist_ok=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  import gradio as gr
37
 
38
  warnings.filterwarnings("ignore")
 
23
  KPipeline,
24
  )
25
 
26
+ import sys
27
+
28
+ # Diagnostic: where is ~/.cache pointing?
29
+ print(f"[DEBUG] HOME = {os.environ.get('HOME')}")
30
+ print(f"[DEBUG] XDG_CACHE_HOME = {os.environ.get('XDG_CACHE_HOME')}")
31
+ print(f"[DEBUG] Trying to create /.cache/test.txt")
32
+
33
+ try:
34
+ os.makedirs("/.cache", exist_ok=True)
35
+ with open("/.cache/test.txt", "w") as f:
36
+ f.write("test")
37
+ print("[DEBUG] Successfully wrote to /.cache")
38
+ except Exception as e:
39
+ print(f"[DEBUG] ❌ Failed to write to /.cache: {e}")
40
+
41
  # Set cache dirs BEFORE importing torch, transformers, or moshi
42
  os.environ["HF_HOME"] = "/tmp/huggingface"
43
  os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
 
48
  # Explicitly override ~/.cache
49
  os.environ["HOME"] = "/tmp/home"
50
  os.makedirs("/tmp/home", exist_ok=True)
51
+
52
+ for path in [
53
+ "/tmp/.cache",
54
+ "/tmp/huggingface",
55
+ "/tmp/huggingface/transformers",
56
+ "/tmp/torch",
57
+ "/tmp/moshi",
58
+ ]:
59
+ os.makedirs(path, exist_ok=True)
60
+
61
+ if not os.path.exists("/.cache"):
62
+ try:
63
+ os.symlink("/tmp/.cache", "/.cache")
64
+ print("[DEBUG] Symlinked /.cache to /tmp/.cache")
65
+ except Exception as e:
66
+ print(f"[DEBUG] Couldn't symlink /.cache: {e}")
67
+
68
  import gradio as gr
69
 
70
  warnings.filterwarnings("ignore")