Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -665,32 +665,33 @@
|
|
| 665 |
|
| 666 |
|
| 667 |
import gradio as gr
|
| 668 |
-
import requests
|
| 669 |
import torch
|
| 670 |
-
from TTS import TTS
|
| 671 |
import TTS.tts.configs.xtts_config
|
| 672 |
import TTS.tts.models.xtts
|
| 673 |
|
| 674 |
-
#
|
| 675 |
torch.serialization.add_safe_globals([
|
| 676 |
TTS.tts.configs.xtts_config.XttsConfig,
|
| 677 |
TTS.tts.models.xtts.XttsAudioConfig
|
| 678 |
])
|
| 679 |
|
| 680 |
-
# โ
|
| 681 |
-
tts = TTS
|
| 682 |
|
| 683 |
def say_bismillah():
|
| 684 |
text = "ุจุณู
ุงููู ุงูุฑุญู
ู ุงูุฑุญูู
"
|
| 685 |
tts.tts_to_file(text=text, language="ar", file_path="bismillah.wav")
|
| 686 |
return "bismillah.wav"
|
| 687 |
|
|
|
|
| 688 |
demo = gr.Interface(
|
| 689 |
fn=say_bismillah,
|
| 690 |
inputs=[],
|
| 691 |
outputs=gr.Audio(label="๐ Listen"),
|
| 692 |
-
title="
|
| 693 |
-
description="
|
| 694 |
)
|
| 695 |
|
| 696 |
demo.launch()
|
|
|
|
|
|
| 665 |
|
| 666 |
|
| 667 |
import gradio as gr
|
|
|
|
| 668 |
import torch
|
| 669 |
+
from TTS.api import TTS
|
| 670 |
import TTS.tts.configs.xtts_config
|
| 671 |
import TTS.tts.models.xtts
|
| 672 |
|
| 673 |
+
# โ
Add safe globals for PyTorch 2.6
|
| 674 |
torch.serialization.add_safe_globals([
|
| 675 |
TTS.tts.configs.xtts_config.XttsConfig,
|
| 676 |
TTS.tts.models.xtts.XttsAudioConfig
|
| 677 |
])
|
| 678 |
|
| 679 |
+
# โ
Load XTTS model
|
| 680 |
+
tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
|
| 681 |
|
| 682 |
def say_bismillah():
|
| 683 |
text = "ุจุณู
ุงููู ุงูุฑุญู
ู ุงูุฑุญูู
"
|
| 684 |
tts.tts_to_file(text=text, language="ar", file_path="bismillah.wav")
|
| 685 |
return "bismillah.wav"
|
| 686 |
|
| 687 |
+
# โ
Gradio Interface
|
| 688 |
demo = gr.Interface(
|
| 689 |
fn=say_bismillah,
|
| 690 |
inputs=[],
|
| 691 |
outputs=gr.Audio(label="๐ Listen"),
|
| 692 |
+
title="XTTS v2 Audio Test",
|
| 693 |
+
description="Arabic voice demo using Coqui's XTTS v2"
|
| 694 |
)
|
| 695 |
|
| 696 |
demo.launch()
|
| 697 |
+
|