Spaces:
Running
Running
Check inputs before the GPU function, so the Space stays quota-safe if it moves to ZeroGPU.
Browse files
app.py
CHANGED
|
@@ -94,13 +94,20 @@ model_card = ModelCard(
|
|
| 94 |
|
| 95 |
|
| 96 |
@torch.inference_mode()
|
| 97 |
-
@spaces.GPU(duration=120)
|
| 98 |
def process_fn(audio_path: str, text_query: str):
|
|
|
|
|
|
|
| 99 |
if model_loading:
|
| 100 |
raise gr.Error("Model is still loading, please wait a moment and try again.")
|
| 101 |
if ss_model is None:
|
| 102 |
raise gr.Error(f"Model failed to load: {model_error}")
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
print(f"Separating [{audio_path}] with query [{text_query}]")
|
| 105 |
|
| 106 |
# The model expects 32 kHz mono. Both are restored after inference, so the
|
|
|
|
| 94 |
|
| 95 |
|
| 96 |
@torch.inference_mode()
|
|
|
|
| 97 |
def process_fn(audio_path: str, text_query: str):
|
| 98 |
+
# Checked before the GPU is reserved, so a request that cannot run spends none of the caller's
|
| 99 |
+
# ZeroGPU allowance
|
| 100 |
if model_loading:
|
| 101 |
raise gr.Error("Model is still loading, please wait a moment and try again.")
|
| 102 |
if ss_model is None:
|
| 103 |
raise gr.Error(f"Model failed to load: {model_error}")
|
| 104 |
|
| 105 |
+
return separate(audio_path, text_query)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
@spaces.GPU(duration=120)
|
| 109 |
+
def separate(audio_path: str, text_query: str):
|
| 110 |
+
|
| 111 |
print(f"Separating [{audio_path}] with query [{text_query}]")
|
| 112 |
|
| 113 |
# The model expects 32 kHz mono. Both are restored after inference, so the
|