elevenlabs / elevenlabs-python

The official Python API for ElevenLabs Text to Speech.
https://elevenlabs.io/docs/api-reference/getting-started
MIT License
2.2k stars 255 forks source link

выдает ошибку #262

Closed LukeArt091 closed 7 months ago

LukeArt091 commented 7 months ago

это мой код:

import speech_recognition as sr
import elevenlabs

r = sr.Recognizer()
elevenlabs.set_api_key("a1c8bd8827e1e523fc104e2efa1f8900")

def listen():
    with sr.Microphone() as source:
        print('я вас слушаю сэр')
        r.adjust_for_ambient_noise(source)

        audio1 = r.listen(source)
        try:
            text = r.recognize_google(audio1, language='ru-RU').lower()
        except sr.UnknownValueError:
            pass
        print(f'Вы сказали: {text} сэр')
        return text

def func1(text):
    if 'джарвис' in text:
        audio = elevenlabs.generate(
            text="С возврашением, сэр!",
            voice="Bill",
            model='eleven_multilingual_v1'
        )

        elevenlabs.play(audio)

listen()

это моя ошибка:

elevenlabs.set_api_key("тут апи")
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'elevenlabs' has no attribute 'set_api_key'

что делать если что у меня нет файла elevenlabs.py

dsinghvi commented 7 months ago

Hi there, as part of the 1.x major version release, the set_api_key function was removed.

Please see the migration build in the readme to migrate, or considering pinning your version to 0.x if necessary: https://github.com/elevenlabs/elevenlabs-python/blob/f19c3ccd286b15e14947dfc8ec58b917e84f9489/README.md#v0x-to-v1x-migration-guide

dsinghvi commented 7 months ago

Feel free to reopen if the issue still persists!