myshell-ai / OpenVoice

Instant voice cloning by MIT and MyShell.
https://research.myshell.ai/open-voice
MIT License
29.93k stars 2.95k forks source link

Error deploying gradio app using OpenVoice V2 into Hugging Face Space #289

Closed LongMingWei closed 4 months ago

LongMingWei commented 4 months ago

When I try to build the app, this error appears Traceback (most recent call last): File "/home/user/app/app.py", line 11, in <module> from melo.api import TTS ModuleNotFoundError: No module named 'melo'

II suspect that MeloTTS does not have a pip install function, which is why I can't use requirements.txt (created using pipreq when inside the local environment) to install it into the space. However, I am also unable to add the MeloTTS repo into the root directory due to the limited capabilities of the git command line (git add MeloTTS/* is completely ignored). Is there a way to install MeloTTS into Hugging Face? Thank you!

dosubot[bot] commented 4 months ago

Hey @LongMingWei! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

To resolve the ModuleNotFoundError: No module named 'melo' error when deploying a Gradio app using OpenVoice V2 in Hugging Face Space, you need to install MeloTTS. You can do this by running the following command:

pip install git+https://github.com/myshell-ai/MeloTTS.git

Additionally, you need to download the necessary language model with:

python -m unidic download

These steps should be included in your setup to ensure that MeloTTS is properly installed and configured [1].

To continue talking to Dosu, mention @dosu.

LongMingWei commented 3 months ago

Hello, I finally found the solution, whoever encountered this problem can also try it. You can actually import github repos as a package by writing git+https://github.com/myshell-ai/MeloTTS.git@main#egg=MeloTTS in the requirements.txt file rather than melotts==0.1.2 (does not exist by the way, just an example).