Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,6 +107,8 @@ import base64
|
|
| 107 |
import logging
|
| 108 |
from typing import Optional
|
| 109 |
import uuid
|
|
|
|
|
|
|
| 110 |
|
| 111 |
# Set up logging
|
| 112 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -115,11 +117,11 @@ logger = logging.getLogger(__name__)
|
|
| 115 |
class TextImageRequest(BaseModel):
|
| 116 |
text: Optional[str] = None
|
| 117 |
image_base64: Optional[str] = None
|
| 118 |
-
voice: str = "af_heart" # Default voice
|
| 119 |
speed: float = 1.0
|
| 120 |
|
| 121 |
-
#
|
| 122 |
-
AVAILABLE_VOICES = ["af_heart"]
|
| 123 |
|
| 124 |
def validate_voice(self):
|
| 125 |
if self.voice not in self.AVAILABLE_VOICES:
|
|
|
|
| 107 |
import logging
|
| 108 |
from typing import Optional
|
| 109 |
import uuid
|
| 110 |
+
from typing import Optional, ClassVar, List
|
| 111 |
+
|
| 112 |
|
| 113 |
# Set up logging
|
| 114 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 117 |
class TextImageRequest(BaseModel):
|
| 118 |
text: Optional[str] = None
|
| 119 |
image_base64: Optional[str] = None
|
| 120 |
+
voice: str = "af_heart" # Default voice
|
| 121 |
speed: float = 1.0
|
| 122 |
|
| 123 |
+
# Annotate as ClassVar to indicate this is not a model field.
|
| 124 |
+
AVAILABLE_VOICES: ClassVar[List[str]] = ["af_heart"]
|
| 125 |
|
| 126 |
def validate_voice(self):
|
| 127 |
if self.voice not in self.AVAILABLE_VOICES:
|