erew123 / alltalk_tts

AllTalk is based on the Coqui TTS engine, similar to the Coqui_tts extension for Text generation webUI, however supports a variety of advanced features, such as a settings page, low VRAM support, DeepSpeed, narrator, model finetuning, custom models, wav file maintenance. It can also be used with 3rd Party software via JSON calls.
GNU Affero General Public License v3.0
1.14k stars 118 forks source link

Fix optional fields in OpenAI API #344

Closed GenericMale closed 2 months ago

GenericMale commented 2 months ago

The optional fields response_format and speed in the OpenAI API (/v1/audio/speech) where causing a KeyError when omitted.

To test this, the example from the OpenAI docs can be used:

curl http://127.0.0.1:7851/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
  }' \
  --output speech.mp3

Was causing:

[AllTalk Debug] Received JSON data: {'model': 'tts-1', 'input': 'The quick brown fox jumped over the lazy dog.', 'voice': 'alloy'}
[AllTalk Debug] An error occurred: 'response_format'

Additionally i changed "python" to sys.executable when the sub processes are spawned, which makes it possible to run it in a venv instead of conda.

erew123 commented 2 months ago

Hi @GenericMale

Thanks for that. Ive checked them over and see no issues with those. Ill pull them in.

Thanks

GenericMale commented 2 months ago

@erew123 awesome, thx! this works great with open-webui now (using the OpenAI API)

lijackcoder commented 2 days ago

@erew123 awesome, thx! this works great with open-webui now (using the OpenAI API)

how do you set up alltalk tts with openwebui?

erew123 commented 2 days ago

@lijackcoder I personally have no idea, @GenericMale may respond. My guess however would be to setup alltalk and then use its OpenAI endpoint https://github.com/erew123/alltalk_tts/wiki/API-%E2%80%90-OpenAI-V1-Speech-Compatible-Endpoint

and probably just follow (Im guessing) this onwards https://docs.openwebui.com/tutorials/integrations/openedai-speech-integration#step-6-configuring-open-webui-to-use-openedai-speech-for-tts

lijackcoder commented 2 days ago

@erew123 Thanks, i got it working its actually simple, I just dont know how to change the different model names for the existing OpenAI voices (like alloy,etc.) It is using female01, I dont know where the location is of where i need to edit the code to get the different voices. (custom voice

erew123 commented 2 days ago

@lijackcoder On a per TTS engine basis, in here: image

lijackcoder commented 2 days ago

Thank you very much! Ill test it out soon.