Commit 655551cc authored by chenpangpang's avatar chenpangpang
Browse files

feat: 初识提交

parent 74928ba0
.idea
chenyh
# pip install huggingface-cli
import os
import requests
import json
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
model_list = [
"coqui/XTTS-v2"
]
for model_path in model_list:
os.system(f"huggingface-cli download --resume-download {model_path} --local-dir ./{model_path} --local-dir-use-symlinks False")
\ No newline at end of file
#!/bin/bash
cd /root/voice-clone
python app.py
---
title: Voice Clone
emoji: 🗣️
colorFrom: pink
colorTo: indigo
sdk: gradio
sdk_version: 4.26.0
app_file: app.py
pinned: false
disable_embedding: true
models:
- coqui/XTTS-v2
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
import spaces
import gradio as gr
import torch
from TTS.api import TTS
import os
os.environ["COQUI_TOS_AGREED"] = "1"
device = "cuda"
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
@spaces.GPU(enable_queue=True)
def clone(text, audio, language):
tts.tts_to_file(text=text, speaker_wav=audio, language=language, file_path="./output.wav")
return "./output.wav"
iface = gr.Interface(fn=clone,
inputs=[gr.Textbox(label='Text'),
gr.Audio(type='filepath', label='Voice reference audio file'),
gr.Dropdown(label='Language',
choices=['en - English', 'fr - French', 'ar - Arabic', 'es - Spanish',
'zh - Chinese', 'ru - Russian', 'pt - Portuguese', 'it - Italian',
'de - German', 'nl - Dutch'])],
outputs=gr.Audio(type='filepath'),
title='Voice Clone',
description="""
by [Tony Assi](https://www.tonyassi.com/)
This space uses xtts_v2 model. Non-commercial use only. [Coqui Public Model License](https://coqui.ai/cpml)
Please ❤️ this Space. <a href="mailto: tony.assi.media@gmail.com">Email me</a>.
""",
theme=gr.themes.Base(primary_hue="teal", secondary_hue="teal", neutral_hue="slate"),
examples=[["Hey! It's me Dorthy, from the Wizard of Oz. Type in whatever you'd like me to say.",
"./audio/Wizard-of-Oz-Dorthy.wav", "en - English"],
["It's me Vito Corleone, from the Godfather. Type in whatever you'd like me to say.",
"./audio/Godfather.wav", "en - English"],
["Hey, it's me Paris Hilton. Type in whatever you'd like me to say.",
"./audio/Paris-Hilton.mp3", "en - English"],
["Hey, it's me Megan Fox from Transformers. Type in whatever you'd like me to say.",
"./audio/Megan-Fox.mp3", "en - English"],
["Hey there, it's me Jeff Goldblum. Type in whatever you'd like me to say.",
"./audio/Jeff-Goldblum.mp3", "en - English"], ])
iface.launch()
\ No newline at end of file
TTS
torch
\ No newline at end of file
{
"cells": [
{
"cell_type": "markdown",
"id": "e5c5a211-2ccd-4341-af10-ac546484b91f",
"metadata": {
"tags": []
},
"source": [
"## 说明\n",
"- 启动需要加载模型,需要1分钟左右的时间\n",
"- 启动和重启 Notebook 点上方工具栏中的「重启并运行所有单元格」。出现如下内容就算成功了:\n",
" - `Running on local URL: http://0.0.0.0:7860`\n",
" - `Running on public URL: https://xxxxxxxxxxxxxxx.gradio.live`\n",
"- 通过以下方式开启页面:\n",
" - 控制台打开「自定义服务」了,访问自定义服务端口号设置为7860\n",
" - 直接打开显示的公开链接`public URL`\n",
"\n",
"## 功能介绍\n",
"- 原项目地址:https://huggingface.co/spaces/tonyassi/voice-clone/tree/main\n",
"- voice-clone:一款声音克隆工具,无需训练,仅需上传一段参考人声、文字即可生成语音。"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53a96614-e2d2-4710-a82b-0d5ca9cb9872",
"metadata": {
"tags": [],
"is_executing": true
},
"outputs": [],
"source": [
"# 启动\n",
"!sh start.sh"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9e81ae9d-3a34-43a0-943a-ff5e9d6ce961",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment