You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This template is only for bug reports. For questions, please visit Discussions.
I have thoroughly reviewed the project documentation (installation, training, inference) but couldn't find information to solve my problem. English中文日本語Portuguese (Brazil)
I have searched for existing issues, including closed ones. Search issues
I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
Please do not modify this template and fill in all required fields.
try to invoke the api_server endpoint passing a base64 reference
POST http://127.0.0.1:18080/v1/tts
Content-Type: application/json
{
"text": "Ciao come va? tutto bene?",
"format":"wav",
"references": [
{
"audio": "PUT_A_BASE_64_AUDIO_DATA_HERE",
"text": "Hello, how are you?"
}
]
}
✔️ Expected Behavior
Base64 is the common way to pass binary array using json, this should be handled
I fixed it in my use case by updating schema.py ServeReferenceAudio class this way
import base64
from pydantic import model_validator
class ServeReferenceAudio(BaseModel):
audio: bytes
text: str
@model_validator(mode="before")
def decode_audio(cls, values):
audio = values.get("audio")
if isinstance(audio, str) and len(audio) > 255: # Check if audio is a string (Base64)
try:
values["audio"] = base64.b64decode(audio)
except Exception as e:
# If the audio is not a valid base64 string, we will just ignore it and let the server handle it
pass
return values
def __repr__(self) -> str:
return f"ServeReferenceAudio(text={self.text!r}, audio_size={len(self.audio)})"
I don't know if it's still compatible with other use cases or if there is a better way to handle this scenario (I'm not used to python)
I added a check for length > 255 so it shouldn't interferee with a path (I saw a similar check in generate.py
If you want I can submit a PR
❌ Actual Behavior
it throws an error about invalid data
The text was updated successfully, but these errors were encountered:
Self Checks
Cloud or Self Hosted
Self Hosted (Docker)
Environment Details
latest docker image ( sha256:40c9620c1dfd8efb1063a5826e72243efafc5f19784af5fa0603238e06b7dd62 )
Steps to Reproduce
try to invoke the api_server endpoint passing a base64 reference
✔️ Expected Behavior
Base64 is the common way to pass binary array using json, this should be handled
I fixed it in my use case by updating schema.py ServeReferenceAudio class this way
I don't know if it's still compatible with other use cases or if there is a better way to handle this scenario (I'm not used to python)
I added a check for length > 255 so it shouldn't interferee with a path (I saw a similar check in generate.py
If you want I can submit a PR
❌ Actual Behavior
it throws an error about invalid data
The text was updated successfully, but these errors were encountered: