mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-12 01:54:38 -05:00
feat: backend support for TTS (Bark, etc.) #48
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @oliverbob on GitHub (Nov 22, 2023).
Is it possible to have a native support for Bark TTS or langchain version of it since we already have that microphone prompt?
@tjbck commented on GitHub (Nov 22, 2023):
Hi, Thanks for the suggestion. Sounds like an interesting idea, I'll see what I can do about it but only after I have every previous feature request out the way. In the meantime, if you could implement a working prototype using python and provide us with implementation examples, that would be sublime. Thanks.
@walking-octopus commented on GitHub (Dec 2, 2023):
Bark is rather unstable, slow, and overkill for an assistant. Piper however seems fine. It also has Python support.
I also wonder if the server or client should be responsible for TTS... It is written in C++, so a WASM port is possible, if desired.
@tjbck commented on GitHub (Dec 5, 2023):
I'll be looking into this in the near future! In the meantime, TTS support is already been implemented with legacy web api. Thanks!
@oliverbob commented on GitHub (Dec 26, 2023):
Since we already have the speaker button there, I think we can integrate piper, since its lightweight and fast.
The only requirement is that the server have piper installed via:
pip install piper-ttsDirectory structure:
/flask-piper-app
│
├── app.py
├── static
│ └── welcome.wav
│
└── templates
└── index.html
Python:
Here's the html (which you can convert to svelte):
This way, our model responses will not sound like Stephen Hawking.
@tjbck commented on GitHub (Dec 26, 2023):
I'll actively take a look after #216, but piper doesn't seem to support macos. If any of you guys know any workarounds for this, please let us know. Thanks.
Encountering this issue: https://github.com/rhasspy/piper/issues/203
@tjbck commented on GitHub (Dec 30, 2023):
Let's get the ball rolling on this one! Stay tuned!
@diblasio commented on GitHub (Dec 31, 2023):
If I may also suggest this feature has an option to use openai tts as well considering there's already a place to input your api key in the UI. Their model sounds more natural for those of us that are attempting to using AI for language learning.
https://platform.openai.com/docs/guides/text-to-speech
@explorigin commented on GitHub (Jan 28, 2024):
Piper will likely support wasm compilation soon which would allow browser-side generation: https://github.com/rhasspy/piper/issues/352
@oliverbob commented on GitHub (Jan 28, 2024):
I have actually made a pull request that integrated piper in it. But I deleted it since I recall that Timothy said, it is not well supported on his macbook or on mac in general.
If you want, I can make a piper integration again, but it would necessitate to "remove the browser Speech recognition default", unless otherwise some would be kind enough to put a new "piper button" as a sign that I should place it back, it (the new speaker icon) should differentiate between Speech Recognition (the default), and the one to be used for piper (since I'm not very good at svelte, but I'm know quite a lot about javascript). The speech though will not be browser controlled (not wasm yet), but it will read the prompt response, send to server and the server audio generated by piper will be served to the browser.
The only downside is that for longer prompts, the rendered audio file would be larger for the most simplified implementation (without using complex compression algorithm).
Let me know so that I can generate a new pull request should this be still helpful. Alternatively, we can create a piper branch for this repo for research purposes for other developers to look and build on the work. Coz, if I'm not mistaken, OpenAIs whisper server is not free of charge. Its fast but not free.
Piper is better than BARK, since you need a huge GPU to run BARK, and it takes hours on smaller GPUs before bark can talk back to the user text prompt. In Piper, for a message this long (as my comment) for a medium size quality voice, will generate between 1-5 mb. It should be installed where the UI is running. Then it will generate voice back to you from the server between 10 seconds to 30 seconds, or sometimes longer. For longer text, it might require a minute. But if you run piper on a GPU, its as quick as lightning, the only downside would just be "how to compress it" after bark generates the audio file. Im sure there are countless developers here who could figure that out on top of the simplest example, coz for longer text, it reaches more mb, and the voice --model WHATEVER-medium.onnx is quite huge (up to 70MB), which shouldn't be included in the pull request, but can be run (downloaded) after running the piper flask server or bash (which can also be included in the Ollama WebUI run script.
@tjbck commented on GitHub (Feb 5, 2024):
backend piper integration blockers:
@tjbck commented on GitHub (Feb 6, 2024):
OpenAI TTS support has been added with #656! As for the local TTS support, piper seems promising so let's wait until they merge the two blocking PRs.
@oliverbob commented on GitHub (Feb 6, 2024):
Thanks Timothy.
@tjbck commented on GitHub (Feb 22, 2024):
Piper library seems to be unmaintained. Looking for alternatives atm, open to suggestions!
@jmtatsch commented on GitHub (Mar 1, 2024):
Piper works well on Mac also if you build from source and make a tiny change to the CMakelist 🙈
I am pretty sure @synesthesiam will get around to merging those pull requests, piper seems to be his baby after all.
He is just incredibly busy with all the voice assistant integration for Home Assistant.
I played around with bark.cpp and coqui.ai TTS and both are far too slow to be useful.
@justinh-rahb commented on GitHub (Mar 1, 2024):
I agree, out of the big three projects for local TTS Piper is probably the best hope we've got.. I really don't understand how this particular niche is so devoid of development, it's one of the most asked-for features in any local AI project.
@synesthesiam commented on GitHub (Mar 2, 2024):
Piper is definitely still being maintained! As @jmtatsch said, I've just been busy with other stuff. One thing that's held up development is needing to replace the espeak-ng library due to its license.
I think this niche is fairly devoid of development because very few projects leave the demo stage before the authors are on to the next model/paper. I want Piper to be more of a "boring" technology in the sense that it does a job well without always chasing state-of-the-art.
@justinh-rahb commented on GitHub (Mar 2, 2024):
I very much agree with that part of the unix philosophy: do one thing and do it well. Thanks for the status update @synesthesiam 🙏
@jmtatsch commented on GitHub (Mar 16, 2024):
Can the existing base url for openai tts be made configurable?
I found this adapter
https://github.com/matatonic/openedai-speech
serving an openai tts api with either piper or coqui TTS the back
@lee-b commented on GitHub (Mar 30, 2024):
This looks very promising. The API seems to work well, and it's a similar docker-based setup to ollama. I agree, just allowing tweaking the OPENAI_BASE_URL for audio would go a long way to fully local whisper+xtts-v2 with this.
@lee-b commented on GitHub (Mar 31, 2024):
FYI, I made this work with a local openedai-speech (linked above) on my branch, here:
https://github.com/lee-b/open-webui
It currently requires an extra environment variable and uses a custom docker file and runner script to run the thing, but it works. I'll integrate this better if the core team want to advise on their preferred way to solve some of the issues that I did these things to hack around.
@fraschm1998 commented on GitHub (Apr 3, 2024):
Any way to fix this?
Server is running:
@fraschm1998 commented on GitHub (Apr 3, 2024):
Fixed with the following, kudos to ChatGPT:
@jmtatsch commented on GitHub (Apr 4, 2024):
I think it would be best if open webui just enables us to set a different TTS base url via ENV variable like OPENAI_TTS_BASE_URL.
Like that users can plug in whatever openai tts compatible server they like and there are no licensing woes.
And it is very little work to do as Openai TTS is already implemented and works beautifully 😍
@jmtatsch commented on GitHub (Apr 10, 2024):
@tjbck would you be open to the approach taken in https://github.com/lee-b/open-webui
should someone create a pull request?
@hxypqr commented on GitHub (Apr 24, 2024):
Is there a simple way to change the TTS model to my own now? I can't stand the voice of this robot lol.
@jmtatsch commented on GitHub (Apr 24, 2024):
since
cbd18ecyou should be able to set your own openai compatible base url@UXVirtual commented on GitHub (Apr 26, 2024):
In case this helps anyone who is running the
open-webuiDocker container along with Ollama on the same PC and using openedai-speech you can use the following for configuration:http://host.docker.internal:8000/v1sk-111111111host.docker.internalis required sinceopenedai-speechis exposed vialocalhoston your PC, butopen-webuicannot normally access this from within its container.Note that
openedai-speechdoesn't need an API key, but setting a dummy one is required due to validation of this field inopen-webui@jmtatsch commented on GitHub (Apr 29, 2024):
Works wonderfully now.
https://github.com/matatonic/openedai-speech wraps piper, xtts_v2 and parler-tts by the way so there is a good choice of qualities and latencies
@justinh-rahb commented on GitHub (Apr 29, 2024):
I'll leave it up to @oliverbob to decide to call this issue fixed or not, or I will close it as such in a few days if we don't hear from them.
@ned14 commented on GitHub (Sep 27, 2024):
If you're doing silly things like me like running this on a Haswell based server a decade old, it would be a lot more natural if the voice started speaking after the first sentence is returned rather than waiting until the entire response is returned. With llama 3.2 1b the token output is just about fast enough to be quicker than the TTS, so this would make everything much more natural.
https://github.com/open-webui/open-webui/issues/478 requested the same thing I noticed. I'm using https://github.com/matatonic/openedai-speech and I can clearly see in its logs that open-webui isn't asking for speech synthesis until the LLM has completed its response. If there were an option to send sentences for speech as soon as it gets them, that would be great.
@thiswillbeyourgithub commented on GitHub (Sep 27, 2024):
I completely agree with you. Actually the code is already there as call mode is already doing this. I do think it would merit being available also outside of call mode. (Which is barely usable on vertical screens includinh phones imo)
@ned14 commented on GitHub (Sep 27, 2024):
Yes, you're right. My hardware is so slow that the 3b model chokes up the speech synthesis. The 1b model works rather better though. If I preloaded the the voice, I think it might work just fine.
Thanks for the tip.