Percy3822 commited on
Commit
ad3982a
·
verified ·
1 Parent(s): 4d1c99f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -176,14 +176,13 @@ def build_piper_cmd(
176
  *PIPER_CMD,
177
  "-m", str(vc["model"]),
178
  "-c", str(vc["config"]),
179
- "-q",
180
- "--length_scale", str(length_scale),
181
- "--noise_scale", str(noise_scale),
182
- "--noise_w", str(noise_w),
183
  ]
184
  if to_stdout:
185
  # Stream RAW PCM (16-bit little-endian)
186
- cmd += ["--raw", "-f", "-"]
187
  else:
188
  if out_path is None:
189
  raise ValueError("out_path required when to_stdout=False")
@@ -283,6 +282,14 @@ def health():
283
  cfg = child / f"{name}.onnx.json"
284
  if _file_ok(base, MIN_ONNX_BYTES) and _file_ok(cfg, MIN_JSON_BYTES):
285
  voices.append({"id": name, "sr": _read_sr_from_cfg(cfg)})
 
 
 
 
 
 
 
 
286
  return {
287
  "ok": True,
288
  "engine": "piper-tts (CLI, CPU)",
@@ -290,6 +297,8 @@ def health():
290
  "voice_dir": str(VOICES_DIR),
291
  "available_voices": voices,
292
  "files_dir": str(FILES_DIR),
 
 
293
  }
294
 
295
  @app.get("/")
 
176
  *PIPER_CMD,
177
  "-m", str(vc["model"]),
178
  "-c", str(vc["config"]),
179
+ "--length-scale", str(length_scale),
180
+ "--noise-scale", str(noise_scale),
181
+ "--noise-w", str(noise_w),
 
182
  ]
183
  if to_stdout:
184
  # Stream RAW PCM (16-bit little-endian)
185
+ cmd += ["-f", "-", "--output-raw"]
186
  else:
187
  if out_path is None:
188
  raise ValueError("out_path required when to_stdout=False")
 
282
  cfg = child / f"{name}.onnx.json"
283
  if _file_ok(base, MIN_ONNX_BYTES) and _file_ok(cfg, MIN_JSON_BYTES):
284
  voices.append({"id": name, "sr": _read_sr_from_cfg(cfg)})
285
+ # optional environment versions
286
+ try:
287
+ import numpy, onnxruntime as ort
288
+ numpy_version = numpy.__version__
289
+ onnxruntime_version = ort.__version__
290
+ except Exception:
291
+ numpy_version = onnxruntime_version = None
292
+
293
  return {
294
  "ok": True,
295
  "engine": "piper-tts (CLI, CPU)",
 
297
  "voice_dir": str(VOICES_DIR),
298
  "available_voices": voices,
299
  "files_dir": str(FILES_DIR),
300
+ "numpy": numpy_version,
301
+ "onnxruntime": onnxruntime_version,
302
  }
303
 
304
  @app.get("/")