Gapeleon commited on
Commit
0b42a1d
·
verified ·
1 Parent(s): 7a59a0f

Swapping to zero-gpu

Browse files

Previous commit works on paid hardware eg. L4s

Files changed (1) hide show
  1. web_ui.py +10 -6
web_ui.py CHANGED
@@ -78,7 +78,9 @@ def validate_audio_input(audio_path):
78
  except Exception as e:
79
  raise ValueError(f"Audio processing failed: {e}")
80
 
81
- @spaces.GPU
 
 
82
  def generate_speech(text, prompt_audio_path):
83
  """Generate speech with GPU acceleration for HF Spaces."""
84
  try:
@@ -243,12 +245,14 @@ def build_interface():
243
  return demo
244
 
245
  if __name__ == "__main__":
 
 
246
  # Initialize model at startup
247
- try:
248
- initialize_model()
249
- logging.info("Model pre-loaded successfully")
250
- except Exception as e:
251
- logging.error(f"Failed to pre-load model: {e}")
252
 
253
  # Launch interface
254
  demo = build_interface()
 
78
  except Exception as e:
79
  raise ValueError(f"Audio processing failed: {e}")
80
 
81
+ #@spaces.GPU
82
+ @spaces.GPU(duration=120) # Swapping to zero-gpu
83
+
84
  def generate_speech(text, prompt_audio_path):
85
  """Generate speech with GPU acceleration for HF Spaces."""
86
  try:
 
245
  return demo
246
 
247
  if __name__ == "__main__":
248
+
249
+ # Removing this for zero-gpu to work.
250
  # Initialize model at startup
251
+ #try:
252
+ # initialize_model()
253
+ # logging.info("Model pre-loaded successfully")
254
+ #except Exception as e:
255
+ # logging.error(f"Failed to pre-load model: {e}")
256
 
257
  # Launch interface
258
  demo = build_interface()