Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 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"""
|