Langchain ElevenLabs

parmarjatin4911@gmail.com - Jan 28 - - Dev Community

Langchain ElevenLabs

Basic

from langchain.tools import ElevenLabsText2SpeechTool

text_to_speak = "Hello world! I am Mervin Praison"

tts = ElevenLabsText2SpeechTool()
speech_file = tts.run(text_to_speak)
tts.play(speech_file)

Interface

from langchain.tools import ElevenLabsText2SpeechTool
import gradio as gr

tts = ElevenLabsText2SpeechTool()

def generate_speech(text_to_speak):
speech_file = tts.run(text_to_speak)
return speech_file

demo = gr.Interface(
fn=generate_speech,
inputs=gr.Textbox(label="Enter Text"),
outputs=gr.Audio(label="Generated Speech"),
)

if name == "main":
demo.launch()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player