crash10155 commited on
Commit
6b28538
Β·
verified Β·
1 Parent(s): 5852a6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -31,26 +31,7 @@ os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "TRUE"
31
  import gradio as gr
32
  import torch
33
  import onnxruntime as ort
34
- try:
35
- from SwitcherAI.utilities import set_temp_directory, get_temp_directory_info
36
-
37
- # Set up proper temp directory for HuggingFace Spaces
38
- temp_base_dir = BASE_DIR / "temp_switcher"
39
- temp_base_dir.mkdir(exist_ok=True)
40
- set_temp_directory(str(temp_base_dir))
41
-
42
- # Print temp directory info for debugging
43
- temp_info = get_temp_directory_info()
44
- print("πŸ”§ SwitcherAI Temp Directory Setup:")
45
- print(f" πŸ“ Base temp: {temp_info['base_temp']}")
46
- print(f" πŸ“ Platform: {temp_info['platform']}")
47
- print(f" πŸ“ HF Spaces: {temp_info['is_hf_spaces']}")
48
- print(f" πŸ“ Exists: {temp_info['temp_exists']}")
49
- print(f" πŸ“ Writable: {temp_info['temp_writable']}")
50
-
51
- except ImportError as e:
52
- print(f"⚠️ Could not import SwitcherAI utilities: {e}")
53
- print("πŸ”„ Using default temp directory behavior")
54
  # Optional imports with graceful degradation
55
  try:
56
  from moviepy.editor import VideoFileClip
@@ -88,7 +69,26 @@ print(f"πŸ“ Base directory: {BASE_DIR}")
88
  print(f"πŸ“‚ Temp directory: {TEMP_DIR}")
89
  print(f"πŸ“€ Output directory: {OUTPUT_DIR}")
90
  print(f"🎯 Assets directory: {ASSETS_DIR}")
91
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  # Download required model files
93
  def download_required_models():
94
  """Download required model files if not present"""
 
31
  import gradio as gr
32
  import torch
33
  import onnxruntime as ort
34
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  # Optional imports with graceful degradation
36
  try:
37
  from moviepy.editor import VideoFileClip
 
69
  print(f"πŸ“‚ Temp directory: {TEMP_DIR}")
70
  print(f"πŸ“€ Output directory: {OUTPUT_DIR}")
71
  print(f"🎯 Assets directory: {ASSETS_DIR}")
72
+ try:
73
+ from SwitcherAI.utilities import set_temp_directory, get_temp_directory_info
74
+
75
+ # Set up proper temp directory for HuggingFace Spaces
76
+ temp_base_dir = BASE_DIR / "temp_switcher"
77
+ temp_base_dir.mkdir(exist_ok=True)
78
+ set_temp_directory(str(temp_base_dir))
79
+
80
+ # Print temp directory info for debugging
81
+ temp_info = get_temp_directory_info()
82
+ print("πŸ”§ SwitcherAI Temp Directory Setup:")
83
+ print(f" πŸ“ Base temp: {temp_info['base_temp']}")
84
+ print(f" πŸ“ Platform: {temp_info['platform']}")
85
+ print(f" πŸ“ HF Spaces: {temp_info['is_hf_spaces']}")
86
+ print(f" πŸ“ Exists: {temp_info['temp_exists']}")
87
+ print(f" πŸ“ Writable: {temp_info['temp_writable']}")
88
+
89
+ except ImportError as e:
90
+ print(f"⚠️ Could not import SwitcherAI utilities: {e}")
91
+ print("πŸ”„ Using default temp directory behavior")
92
  # Download required model files
93
  def download_required_models():
94
  """Download required model files if not present"""