ConectaPrimoAI commited on
Commit
c6e7069
·
verified ·
1 Parent(s): dce30ce

Upload folder using huggingface_hub

Browse files
__pycache__/armazenamento.cpython-314.pyc CHANGED
Binary files a/__pycache__/armazenamento.cpython-314.pyc and b/__pycache__/armazenamento.cpython-314.pyc differ
 
__pycache__/nucleo.cpython-314.pyc CHANGED
Binary files a/__pycache__/nucleo.cpython-314.pyc and b/__pycache__/nucleo.cpython-314.pyc differ
 
app.py CHANGED
@@ -102,12 +102,16 @@ def _falar_live(segredo: str, texto: str):
102
  if _RAPIDO["tts"] is None:
103
  import torch
104
  from rapido import Rapido
105
- torch.set_num_threads(max(1, os.cpu_count() or 2))
 
106
  _RAPIDO["tts"] = Rapido.from_pretrained(device="cpu")
107
  import base64, io, time as _t, wave
108
  import numpy as np
109
  t0 = _t.time()
110
- r = _RAPIDO["tts"].synthesize(texto)
 
 
 
111
  audio, taxa = r.output["audio"], r.output["sample_rate"]
112
  if taxa == 48000:
113
  audio = audio[: len(audio) // 2 * 2].reshape(-1, 2).mean(axis=1)
@@ -117,7 +121,7 @@ def _falar_live(segredo: str, texto: str):
117
  with wave.open(buf, "wb") as w:
118
  w.setnchannels(1); w.setsampwidth(2); w.setframerate(taxa); w.writeframes(pcm.tobytes())
119
  return {"audio_base64": base64.b64encode(buf.getvalue()).decode(), "mime": "audio/wav",
120
- "segundos": round(_t.time() - t0, 2)}
121
  except Exception as e:
122
  return {"erro": f"{type(e).__name__}: {str(e)[:200]}"}
123
 
 
102
  if _RAPIDO["tts"] is None:
103
  import torch
104
  from rapido import Rapido
105
+ # Poucos núcleos: a CPU do Space é dividida, e núcleos demais brigam.
106
+ torch.set_num_threads(max(1, min(4, os.cpu_count() or 2)))
107
  _RAPIDO["tts"] = Rapido.from_pretrained(device="cpu")
108
  import base64, io, time as _t, wave
109
  import numpy as np
110
  t0 = _t.time()
111
+ # 4 passos e não 8: na CPU deste Space a frase levava ~6 s, e numa
112
+ # conversa falada isso é silêncio. Medido: 4 passos cortam o tempo da
113
+ # difusão quase pela metade, com a mesma fala.
114
+ r = _RAPIDO["tts"].synthesize(texto, steps=4)
115
  audio, taxa = r.output["audio"], r.output["sample_rate"]
116
  if taxa == 48000:
117
  audio = audio[: len(audio) // 2 * 2].reshape(-1, 2).mean(axis=1)
 
121
  with wave.open(buf, "wb") as w:
122
  w.setnchannels(1); w.setsampwidth(2); w.setframerate(taxa); w.writeframes(pcm.tobytes())
123
  return {"audio_base64": base64.b64encode(buf.getvalue()).decode(), "mime": "audio/wav",
124
+ "segundos": round(_t.time() - t0, 2), "nucleos": os.cpu_count()}
125
  except Exception as e:
126
  return {"erro": f"{type(e).__name__}: {str(e)[:200]}"}
127
 
modelos/__pycache__/__init__.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/__init__.cpython-314.pyc and b/modelos/__pycache__/__init__.cpython-314.pyc differ
 
modelos/__pycache__/ace_step.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/ace_step.cpython-314.pyc and b/modelos/__pycache__/ace_step.cpython-314.pyc differ
 
modelos/__pycache__/base.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/base.cpython-314.pyc and b/modelos/__pycache__/base.cpython-314.pyc differ
 
modelos/__pycache__/escolha.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/escolha.cpython-314.pyc and b/modelos/__pycache__/escolha.cpython-314.pyc differ
 
modelos/__pycache__/qwen3_tts.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/qwen3_tts.cpython-314.pyc and b/modelos/__pycache__/qwen3_tts.cpython-314.pyc differ
 
modelos/__pycache__/qwen_image.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/qwen_image.cpython-314.pyc and b/modelos/__pycache__/qwen_image.cpython-314.pyc differ
 
modelos/__pycache__/wan22.cpython-314.pyc CHANGED
Binary files a/modelos/__pycache__/wan22.cpython-314.pyc and b/modelos/__pycache__/wan22.cpython-314.pyc differ