Instructions to use Ritori/Yue_tacotron2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ritori/Yue_tacotron2 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Ritori/Yue_tacotron2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| import gradio as gr | |
| import torch | |
| from transformers import T5ForConditionalGeneration,T5Tokenizer | |
| import soundfile as sf | |
| import librosa | |
| from transformers import pipeline | |
| import requests | |
| import json | |
| API_TOKEN = 'your-api-token' # 你在Hugging Face网站上的API令牌 | |
| API_URL = 'https://api-inference.huggingface.co/models/gpt2' # 根据你的模型选择合适的URL | |
| headers = { | |
| "Authorization": f"Bearer {API_TOKEN}", | |
| } | |
| def generate(inp): | |
| data = json.dumps({"inputs": inp}) | |
| response = requests.request("POST", API_URL, headers=headers, data=data) | |
| return json.loads(response.content.decode("utf-8"))[0]['generated_text'] | |
| iface = gr.Interface( | |
| fn=generate, | |
| inputs=gr.inputs.Textbox(lines=5, label="Input Text"), | |
| outputs="text", | |
| title="Text-to-Speech", | |
| description="Convert your text into speech!", | |
| ) | |
| iface.launch() | |