Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +10 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from numpy import int16,float32
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import AutoModel
|
4 |
+
model = AutoModel.from_pretrained("ai4bharat/IndicF5", trust_remote_code=True).to("cpu")
|
5 |
+
def synthesize_speech(text, ref_audio, ref_text):
|
6 |
+
audio = model(text, ref_audio_path=ref_audio, ref_text=ref_text)
|
7 |
+
if audio.dtype == int16:
|
8 |
+
audio = audio.astype(float32) / 32768.0
|
9 |
+
return 24000, audio
|
10 |
+
gr.Interface(synthesize_speech,[gr.Textbox(label="Text to Synthesize"), gr.Audio(type="filepath", label="Reference Prompt Audio"), gr.Textbox(label="Text in Reference Prompt Audio")], gr.Audio(label="Generated Speech", type="numpy")).launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
git+https://github.com/ai4bharat/IndicF5.git
|