Merlimhhs commited on
Commit
5ee3fe8
·
verified ·
1 Parent(s): 3870333

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -15,6 +15,28 @@ import soundfile as sf
15
  import torch
16
  from kokoro import KModel, KPipeline
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  MODEL_REPO = "hexgrad/Kokoro-82M"
19
  LANG_CODE = "p" # Português brasileiro (pt-br)
20
  SAMPLE_RATE = 24_000
 
15
  import torch
16
  from kokoro import KModel, KPipeline
17
 
18
+ # O ZeroGPU exige que exista ao menos uma função marcada com @spaces.GPU
19
+ # durante o startup. Esta função é intencionalmente vazia: a síntese abaixo
20
+ # continua fixada em CPU e não solicita cota de GPU.
21
+ try:
22
+ import spaces
23
+ except ImportError:
24
+ class _SpacesCompat:
25
+ @staticmethod
26
+ def GPU(function=None, **_kwargs):
27
+ if function is None:
28
+ return lambda decorated: decorated
29
+ return function
30
+
31
+ spaces = _SpacesCompat()
32
+
33
+
34
+ @spaces.GPU
35
+ def zerogpu_startup_dummy():
36
+ """Marcador exigido pelo runtime ZeroGPU; não executa inferência."""
37
+ return None
38
+
39
+
40
  MODEL_REPO = "hexgrad/Kokoro-82M"
41
  LANG_CODE = "p" # Português brasileiro (pt-br)
42
  SAMPLE_RATE = 24_000