Tomtom84 commited on
Commit
c9a4bcd
·
verified ·
1 Parent(s): 118942c

Update engines/orpheus_engine.py

Browse files
Files changed (1) hide show
  1. engines/orpheus_engine.py +29 -36
engines/orpheus_engine.py CHANGED
@@ -34,7 +34,29 @@ class OrpheusEngine(BaseEngine):
34
 
35
  This engine supports real-time token generation, audio synthesis, and voice configuration.
36
  """
37
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  def __init__(
39
  self,
40
  api_url: str = DEFAULT_API_URL,
@@ -73,7 +95,7 @@ class OrpheusEngine(BaseEngine):
73
  self.debug = debug
74
  self.queue = Queue()
75
  self.post_init()
76
-
77
  def post_init(self):
78
  """Set up additional engine attributes."""
79
  self.engine_name = "orpheus"
@@ -305,42 +327,13 @@ class OrpheusEngine(BaseEngine):
305
  logging.info("Returning None after failed conversion.")
306
  return None
307
 
308
-
309
- _SPEAKERS = [
310
- # männlich
311
- OrpheusVoice("Jakob", "m"),
312
- OrpheusVoice("Anton", "m"),
313
- OrpheusVoice("Julian", "m"),
314
- OrpheusVoice("Jan", "m"),
315
- OrpheusVoice("Alexander", "m"),
316
- OrpheusVoice("Emil", "m"),
317
- OrpheusVoice("Ben", "m"),
318
- OrpheusVoice("Elias", "m"),
319
- OrpheusVoice("Felix", "m"),
320
- OrpheusVoice("Jonas", "m"),
321
- OrpheusVoice("Noah", "m"),
322
- OrpheusVoice("Maximilian", "m"),
323
- # weiblich
324
- OrpheusVoice("Sophie", "f"),
325
- OrpheusVoice("Marie", "f"),
326
- OrpheusVoice("Mia", "f"),
327
- OrpheusVoice("Maria", "f"),
328
- OrpheusVoice("Sophia", "f"),
329
- OrpheusVoice("Lina", "f"),
330
- OrpheusVoice("Lea", "f"),
331
- ]
332
-
333
- # -----------------------------------------------------------
334
- # Public API, damit das FastAPI-Backend sie abfragen kann
335
- # -----------------------------------------------------------
336
- def get_voices(self) -> list[OrpheusVoice]:
337
- """Return a list of available voices for the Kartoffel checkpoint."""
338
  return self._SPEAKERS
339
-
340
  def set_voice(self, voice_name: str) -> None:
341
- if voice_name not in [v.name for v in self._SPEAKERS]:
342
- raise ValueError(f"Unknown Orpheus speaker '{voice_name}'")
343
- self.voice = OrpheusVoice(voice_name) # <–– wichtig
344
 
345
  def set_voice_parameters(self, **kwargs):
346
  """
 
34
 
35
  This engine supports real-time token generation, audio synthesis, and voice configuration.
36
  """
37
+ _SPEAKERS = [
38
+ # männlich
39
+ OrpheusVoice("Jakob", "m"),
40
+ OrpheusVoice("Anton", "m"),
41
+ OrpheusVoice("Julian", "m"),
42
+ OrpheusVoice("Jan", "m"),
43
+ OrpheusVoice("Alexander", "m"),
44
+ OrpheusVoice("Emil", "m"),
45
+ OrpheusVoice("Ben", "m"),
46
+ OrpheusVoice("Elias", "m"),
47
+ OrpheusVoice("Felix", "m"),
48
+ OrpheusVoice("Jonas", "m"),
49
+ OrpheusVoice("Noah", "m"),
50
+ OrpheusVoice("Maximilian", "m"),
51
+ # weiblich
52
+ OrpheusVoice("Sophie", "f"),
53
+ OrpheusVoice("Marie", "f"),
54
+ OrpheusVoice("Mia", "f"),
55
+ OrpheusVoice("Maria", "f"),
56
+ OrpheusVoice("Sophia", "f"),
57
+ OrpheusVoice("Lina", "f"),
58
+ OrpheusVoice("Lea", "f"),
59
+ ]
60
  def __init__(
61
  self,
62
  api_url: str = DEFAULT_API_URL,
 
95
  self.debug = debug
96
  self.queue = Queue()
97
  self.post_init()
98
+
99
  def post_init(self):
100
  """Set up additional engine attributes."""
101
  self.engine_name = "orpheus"
 
327
  logging.info("Returning None after failed conversion.")
328
  return None
329
 
330
+ def get_voices(self): # FastAPI /voices-Route
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  return self._SPEAKERS
332
+
333
  def set_voice(self, voice_name: str) -> None:
334
+ if voice_name not in [v.name for v in self._SPEAKERS]:
335
+ raise ValueError(f"Unknown Orpheus speaker '{voice_name}'")
336
+ self.voice = OrpheusVoice(voice_name)
337
 
338
  def set_voice_parameters(self, **kwargs):
339
  """