|
<html> |
|
<head> |
|
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script> |
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" /> |
|
</head> |
|
<body> |
|
<gradio-lite> |
|
|
|
<gradio-requirements> |
|
transformers_js_py |
|
</gradio-requirements> |
|
|
|
<gradio-file name="app.py" entrypoint> |
|
from transformers_js import import_transformers_js |
|
import gradio as gr |
|
|
|
speaker_embeddings = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin'; |
|
|
|
transformers = await import_transformers_js() |
|
pipeline = transformers.pipeline |
|
synthesizer = await pipeline('text-to-speech', 'Xenova/speecht5_tts', { "quantized": False }) |
|
|
|
async def classify(text): |
|
return await synthesizer(text, { "speaker_embeddings": speaker_embeddings }); |
|
|
|
demo = gr.Interface(classify, "textbox", "audio") |
|
demo.launch() |
|
</gradio-file> |
|
|
|
</gradio-lite> |
|
|
|
</body> |
|
</html> |
|
|