Spaces:
Running
Running
Upload tts_service.py
Browse files- tts_service.py +2 -2
tts_service.py
CHANGED
@@ -69,6 +69,7 @@ async def ensure_storage_path():
|
|
69 |
"""
|
70 |
التأكد من وجود مجلد لتخزين ملفات الصوت
|
71 |
"""
|
|
|
72 |
try:
|
73 |
# Create directory if it doesn't exist
|
74 |
Path(AUDIO_STORAGE_PATH).mkdir(parents=True, exist_ok=True)
|
@@ -91,7 +92,6 @@ async def ensure_storage_path():
|
|
91 |
try:
|
92 |
Path(alt_path).mkdir(parents=True, exist_ok=True)
|
93 |
print(f"⚠️ Using alternate audio path: {alt_path}")
|
94 |
-
global AUDIO_STORAGE_PATH
|
95 |
AUDIO_STORAGE_PATH = alt_path
|
96 |
return True
|
97 |
except Exception as alt_e:
|
@@ -157,8 +157,8 @@ def get_audio_url(filename: str, speed: float = 1.0) -> str:
|
|
157 |
"""
|
158 |
الحصول على رابط الملف الصوتي مع معلومات السرعة
|
159 |
"""
|
160 |
-
# Update BASE_URL if needed for Hugging Face Spaces
|
161 |
global BASE_URL
|
|
|
162 |
if os.path.exists("/code") and "localhost" in BASE_URL:
|
163 |
# We're in Hugging Face Spaces but using localhost URL
|
164 |
# This can happen if the environment variable wasn't set correctly
|
|
|
69 |
"""
|
70 |
التأكد من وجود مجلد لتخزين ملفات الصوت
|
71 |
"""
|
72 |
+
global AUDIO_STORAGE_PATH
|
73 |
try:
|
74 |
# Create directory if it doesn't exist
|
75 |
Path(AUDIO_STORAGE_PATH).mkdir(parents=True, exist_ok=True)
|
|
|
92 |
try:
|
93 |
Path(alt_path).mkdir(parents=True, exist_ok=True)
|
94 |
print(f"⚠️ Using alternate audio path: {alt_path}")
|
|
|
95 |
AUDIO_STORAGE_PATH = alt_path
|
96 |
return True
|
97 |
except Exception as alt_e:
|
|
|
157 |
"""
|
158 |
الحصول على رابط الملف الصوتي مع معلومات السرعة
|
159 |
"""
|
|
|
160 |
global BASE_URL
|
161 |
+
# Update BASE_URL if needed for Hugging Face Spaces
|
162 |
if os.path.exists("/code") and "localhost" in BASE_URL:
|
163 |
# We're in Hugging Face Spaces but using localhost URL
|
164 |
# This can happen if the environment variable wasn't set correctly
|