Closed wanglongpeng1 closed 3 months ago
@wanglongpeng1 can you provide a reproduction of this issue? The tests in the repository indicate that this is not the case, so its possible you are on a legacy version of the SDK
Hello, this is my source code 您好,这是我的源代码
import os from typing import Optional from dotenv import load_dotenv from dubbing_utils import download_dubbed_file, wait_for_dubbing_completion from elevenlabs.client import EleventLabs
ELEVENTLABS_API_KEY = os.environ.get("ELEVENTLABS_API_KEY") client = EleventLabs(api_key=ELEVENTLABS_API_KEY)
def create_dub_from_url(source_url, source_language, target_language:str): response = client.dubbing.dub_a_video_or_an_audio_file( source_url = source_url, target_lang = target_language, mode = "automatic", source_lang = source_language, num_speakers = 1, watermark=True, ) dubbing_id = response.dubbing_id if wait_for_dubbing_completion(dubbing_id): output_file_path = download_dubbed_file(dubbing_id, target_language) return output_file_path else: return None
if name == "main": source_url = "https://www.youtube.com/watch?v=JEjdHhBH1aY" source_language = "en" target_language = "ch"
result = create_dub_from_url(source_url, source_language, target_language, num_speakers)
if result:
print("Successful!Fail saved at:", result)
else:
print("Failed or time out.")
@wanglongpeng1 I would recommend not sharing your API key. Also looks like there is a typo in your source code EleventLabs
instead of ElevenLabs
.
Closing this issue for now.
Sorry, I have changed the question of EleventLabs instead of ElevenLabs, but I found another problem. def download_dubbed_file(dubbing_id: str, language_code: str) -> str: """ Downloads the dubbed file for a given dubbing ID and language code.
Args:
dubbing_id: The ID of the dubbing project.
language_code: The language code for the dubbing.
Returns:
The file path to the downloaded dubbed file.
"""
dir_path = f"data/{dubbing_id}"
os.makedirs(dir_path, exist_ok=True)
file_path = f"{dir_path}/{language_code}.mp4"
with open(file_path, "wb") as file:
for chunk in client.dubbing.get_dubbed_file(dubbing_id, language_code):
file.write(chunk)
return file_path
for_loop The return of for_loop is empty, this is my error.
Dubbing in progress... Will check status again in 10 seconds.
Dubbing in progress... Will check status again in 10 seconds.
Traceback (most recent call last):
File "/datahdd/wyz/wlp/11LABS_Dubbings/examples/create_a_dub_from_file.py", line 65, in
from elevenlabs.client import ElevenLabs ModuleNotFoundError: No module named 'elevenlabs.client' 我在之前的issue#180 ModuleNotFoundError: No module named 'elevenlabs.client'中看到了一样的问题,但是他的解决办法已经失效了,我想知道这个问题有新的解决办法吗 为什么导致了这个问题
I saw the same problem in the previous issue #180 ModuleNotFoundError: No module named'elevenlabs.client ', but his solution has failed. I want to know if there is a new solution to this problem and why it caused this problem.