planetBlind73 commited on
Commit
d6d7f33
·
verified ·
1 Parent(s): b489834

File structure for the Hugging Face Space: ├── app.py ├── requirements.txt └── README.md --- app.py --- import gradio as gr from transformers import pipeline Load the text-to-speech pipeline with the specified model tts = pipeline("text-to-speech", "wasmdashai/vits-ar-sa-huba-v2") Define the synthesis function def synthesize(text: str): # Generate speech from input text result = tts(text) # The pipeline returns a dict with 'audio' (np.ndarray) and 'sampling_rate' audio = result["audio"] sr = result["sampling_rate"] return sr, audio Build Gradio interface demo = gr.Interface( fn=synthesize, inputs=gr.Textbox(lines=3, label="Arabic Text for Synthesis", placeholder="اكتب نصاً هنا..."), outputs=gr.Audio(type="numpy", label="Generated Speech"), title="VITS Arabic (Saudi Hijazi) TTS", description="A demo of the vits-ar-sa-huba-v2 text-to-speech model from WasmDash AI." ) Launch the app if name == "main": demo.launch() --- requirements.txt --- gradio for UI, transformers and torch for the pipeline pin versions for reproducibility Ensure that the huggingface_hub version supports TTS pipelines gradio>=3.0 transformers>=4.32.0 torch>=1.13.0 huggingface_hub>=0.15.0 --- README.md --- VITS Arabic (Saudi Hijazi) TTS Space This Hugging Face Space demonstrates the wasmdashai/vits-ar-sa-huba-v2 text-to-speech model. Simply enter Arabic text and listen to the synthesized speech. Files app.py: Gradio application loading the TTS pipeline. requirements.txt: Python dependencies. README.md: This documentation. How to Deploy 1. Create a new Space on Hugging Face: choose SDK = "Gradio (Python)". 2. Upload these three files into the repository. 3. Your Space will automatically build and run without further edits. Enjoy!

Browse files
Files changed (1) hide show
  1. app.py +0 -0
app.py ADDED
File without changes