Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -667,31 +667,27 @@
|
|
| 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
|
| 683 |
-
text = "
|
| 684 |
-
tts.tts_to_file(text=text, language="ar", file_path="
|
| 685 |
-
return "
|
| 686 |
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
fn=say_bismillah,
|
| 690 |
inputs=[],
|
| 691 |
-
outputs=gr.Audio(label="
|
| 692 |
-
title="
|
| 693 |
-
description="
|
| 694 |
-
)
|
| 695 |
-
|
| 696 |
-
demo.launch()
|
| 697 |
|
|
|
|
| 667 |
import gradio as gr
|
| 668 |
import torch
|
| 669 |
from TTS.api import TTS
|
| 670 |
+
|
| 671 |
import TTS.tts.configs.xtts_config
|
| 672 |
import TTS.tts.models.xtts
|
| 673 |
|
|
|
|
| 674 |
torch.serialization.add_safe_globals([
|
| 675 |
TTS.tts.configs.xtts_config.XttsConfig,
|
| 676 |
TTS.tts.models.xtts.XttsAudioConfig
|
| 677 |
])
|
| 678 |
|
|
|
|
| 679 |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
|
| 680 |
|
| 681 |
+
def speak():
|
| 682 |
+
text = "ุงูุณูุงู
ุนูููู
ูุฑุญู
ุฉ ุงููู ูุจุฑูุงุชู"
|
| 683 |
+
tts.tts_to_file(text=text, language="ar", file_path="voice.wav")
|
| 684 |
+
return "voice.wav"
|
| 685 |
|
| 686 |
+
gr.Interface(
|
| 687 |
+
fn=speak,
|
|
|
|
| 688 |
inputs=[],
|
| 689 |
+
outputs=gr.Audio(label="Listen"),
|
| 690 |
+
title="Arabic Voice Test",
|
| 691 |
+
description="AI voice using XTTS v2"
|
| 692 |
+
).launch()
|
|
|
|
|
|
|
| 693 |
|