Prof-Hunt commited on
Commit
80bbef5
·
verified ·
1 Parent(s): 5028ed3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -15,6 +15,12 @@ from kokoro import KModel, KPipeline
15
  import soundfile as sf
16
  import math
17
 
 
 
 
 
 
 
18
  def clear_memory():
19
  """Helper function to clear both CUDA and system memory, safe for Spaces environment"""
20
  gc.collect()
 
15
  import soundfile as sf
16
  import math
17
 
18
+ @spaces.GPU(duration=300) # Keep GPU active for 5 min
19
+ def hold_gpu():
20
+ while True:
21
+ time.sleep(10) # Keeps function running to hold the GPU
22
+ hold_gpu()
23
+
24
  def clear_memory():
25
  """Helper function to clear both CUDA and system memory, safe for Spaces environment"""
26
  gc.collect()