Tomtom84 commited on
Commit
fb65c16
·
verified ·
1 Parent(s): dd69770

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -49,6 +49,8 @@ engines["orpheus"] = OrpheusEngine(
49
  model=os.getenv("ORPHEUS_MODEL") # Kartoffel-ID
50
  )
51
 
 
 
52
  # change start engine by moving engine name
53
  # to the first position in SUPPORTED_ENGINES
54
  # START_ENGINE = SUPPORTED_ENGINES[0]
@@ -238,13 +240,11 @@ async def tts(request: Request, text: str = Query(...)):
238
  def get_engines():
239
  return list(engines.keys())
240
 
241
-
242
  @app.get("/voices")
243
  def get_voices():
244
- voices_list = []
245
- for voice in voices[current_engine.engine_name]:
246
- voices_list.append(voice.name)
247
- return voices_list
248
 
249
 
250
  @app.get("/setvoice")
 
49
  model=os.getenv("ORPHEUS_MODEL") # Kartoffel-ID
50
  )
51
 
52
+ voices["orpheus"] = engines["orpheus"].get_voices()
53
+
54
  # change start engine by moving engine name
55
  # to the first position in SUPPORTED_ENGINES
56
  # START_ENGINE = SUPPORTED_ENGINES[0]
 
240
  def get_engines():
241
  return list(engines.keys())
242
 
 
243
  @app.get("/voices")
244
  def get_voices():
245
+ if current_engine is None:
246
+ return []
247
+ return [v.name for v in voices.get(current_engine.engine_name, [])]
 
248
 
249
 
250
  @app.get("/setvoice")