Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -228,12 +228,10 @@ def generate_speech(
|
|
| 228 |
|
| 229 |
# Move model back to CPU to free GPU memory
|
| 230 |
MODEL.to("cpu")
|
| 231 |
-
torch.cpu.empty_cache()
|
| 232 |
|
| 233 |
return output_path, status
|
| 234 |
else:
|
| 235 |
MODEL.to("cpu")
|
| 236 |
-
torch.cpu.empty_cache()
|
| 237 |
return None, "❌ Error: No audio output generated."
|
| 238 |
|
| 239 |
except Exception as e:
|
|
@@ -245,7 +243,6 @@ def generate_speech(
|
|
| 245 |
# Clean up GPU memory on error
|
| 246 |
try:
|
| 247 |
MODEL.to("cpu")
|
| 248 |
-
torch.cpu.empty_cache()
|
| 249 |
except:
|
| 250 |
pass
|
| 251 |
|
|
|
|
| 228 |
|
| 229 |
# Move model back to CPU to free GPU memory
|
| 230 |
MODEL.to("cpu")
|
|
|
|
| 231 |
|
| 232 |
return output_path, status
|
| 233 |
else:
|
| 234 |
MODEL.to("cpu")
|
|
|
|
| 235 |
return None, "❌ Error: No audio output generated."
|
| 236 |
|
| 237 |
except Exception as e:
|
|
|
|
| 243 |
# Clean up GPU memory on error
|
| 244 |
try:
|
| 245 |
MODEL.to("cpu")
|
|
|
|
| 246 |
except:
|
| 247 |
pass
|
| 248 |
|