RaSan147 / VoiceAI-Asuna

If you're familiar with the anime Sword art online, you know it! This project is a virtual Assistant for multiple OS
https://ai-asuna.onrender.com
Apache License 2.0
27 stars 5 forks source link

tts for the chat bot #13

Open s-b-repo opened 1 year ago

s-b-repo commented 1 year ago

you'll need to create an endpoint in your website's backend that takes in text input and outputs the synthesized audio. You can use the Tortoise-TTS library in your backend code to generate the audio. Here's a sample code snippet in Python:

python

from tortoiseTTS import Tortoise

def generate_audio(text): tortoise = Tortoise() audio = tortoise.say(text) return audio

You can expose this function as an API endpoint using a Python web framework like Flask or Django. For example, with Flask:

python

from flask import Flask, request

app = Flask(name)

@app.route('/api/synthesize', methods=['POST']) def synthesize(): text = request.form.get('text') audio = generate_audio(text) return audio

if name == 'main': app.run()

Note that this is just a basic example, and you may need to modify it depending on your specific use case. Also, be aware that generating audio can be a computationally intensive task, so you may want to optimize the code for performance if you expect a high volume of requests.

RaSan147 commented 1 year ago

Optimization idea: store common audios in storage. Not planning to generate TTS on running computer, instead on api basis. Checking your code. Thanks

RaSan147 commented 1 year ago

Output looks great. But needs a gpu and probably won't run on potato pc and definitely not small cloud hostings...scared ti use this one. Keeping it as a good option .

s-b-repo commented 1 year ago

Output looks great. But needs a gpu and probably won't run on potato pc and definitely not small cloud hostings...scared ti use this one. Keeping it as a good option .

my brother uses aws its afordable for small use cases the charge on terabytes space and heavy usage or you can try linode

s-b-repo commented 1 year ago

Output looks great. But needs a gpu and probably won't run on potato pc and definitely not small cloud hostings...scared ti use this one. Keeping it as a good option .

and you can always save it to a data base where it save multiable responses to the same question like 20 each like saving the replys and play them

RaSan147 commented 1 year ago

The issue is it doesn't generate same output, instead genetes random msg on every query, so caching might help but not always. generating every tts locally , i can smell my gou burnibg

RaSan147 commented 1 year ago

Currently using edge-tts