Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,7 @@ MODEL_TIMEOUT_MINUTES = 60
|
|
| 36 |
CHUNK_LENGTH = 30
|
| 37 |
MAX_WORKERS = 4
|
| 38 |
|
|
|
|
| 39 |
# Device configuration
|
| 40 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 41 |
logger.info(f"Using device: {device}")
|
|
@@ -167,6 +168,7 @@ class OptimizedModelManager:
|
|
| 167 |
self.cleanup_timer = threading.Timer(remaining_time, self.check_and_cleanup)
|
| 168 |
self.cleanup_timer.start()
|
| 169 |
|
|
|
|
| 170 |
# Global model manager instance
|
| 171 |
model_manager = OptimizedModelManager()
|
| 172 |
|
|
@@ -208,7 +210,6 @@ def fast_audio_preprocessing(file_path):
|
|
| 208 |
librosa.cache.set_cache(None)
|
| 209 |
logger.info("Librosa cache disabled successfully")
|
| 210 |
except (ImportError, AttributeError) as cache_error:
|
| 211 |
-
# در برخی نسخههای librosa ماژول cache وجود ندارد
|
| 212 |
logger.info(f"Librosa cache module not available: {cache_error}")
|
| 213 |
|
| 214 |
# استفاده از librosa برای بارگذاری سریعتر
|
|
|
|
| 36 |
CHUNK_LENGTH = 30
|
| 37 |
MAX_WORKERS = 4
|
| 38 |
|
| 39 |
+
|
| 40 |
# Device configuration
|
| 41 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 42 |
logger.info(f"Using device: {device}")
|
|
|
|
| 168 |
self.cleanup_timer = threading.Timer(remaining_time, self.check_and_cleanup)
|
| 169 |
self.cleanup_timer.start()
|
| 170 |
|
| 171 |
+
|
| 172 |
# Global model manager instance
|
| 173 |
model_manager = OptimizedModelManager()
|
| 174 |
|
|
|
|
| 210 |
librosa.cache.set_cache(None)
|
| 211 |
logger.info("Librosa cache disabled successfully")
|
| 212 |
except (ImportError, AttributeError) as cache_error:
|
|
|
|
| 213 |
logger.info(f"Librosa cache module not available: {cache_error}")
|
| 214 |
|
| 215 |
# استفاده از librosa برای بارگذاری سریعتر
|