Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,43 +1,31 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
-
import requests
|
| 4 |
-
import torch
|
| 5 |
-
import asyncio
|
| 6 |
import edge_tts
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
# Model
|
| 9 |
-
|
| 10 |
-
INDEX_URL = "https://huggingface.co/spaces/Mujeeb26/Mujeebvoice/resolve/main/Mujeeb_Voice.index"
|
| 11 |
-
|
| 12 |
-
def setup():
|
| 13 |
-
if not os.path.exists("model.pth"):
|
| 14 |
-
open("model.pth", "wb").write(requests.get(PTH_URL).content)
|
| 15 |
-
if not os.path.exists("model.index"):
|
| 16 |
-
open("model.index", "wb").write(requests.get(INDEX_URL).content)
|
| 17 |
-
return "✅ Mujeeb Voice Model is Active!"
|
| 18 |
|
| 19 |
-
async def
|
| 20 |
-
if not text:
|
| 21 |
-
return None
|
| 22 |
|
| 23 |
-
# 1.
|
| 24 |
communicate = edge_tts.Communicate(text, "ur-PK-AsadNeural")
|
| 25 |
-
await communicate.save("
|
| 26 |
|
| 27 |
-
# Yahan
|
| 28 |
-
#
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
-
with gr.Blocks(
|
| 32 |
-
gr.Markdown("# 🎙️ Mujeeb AI
|
| 33 |
-
status = gr.Markdown(setup())
|
| 34 |
-
|
| 35 |
-
with gr.Row():
|
| 36 |
-
txt = gr.Textbox(label="Sindhi/English Text Likhen", placeholder="Kiyan ahyo?")
|
| 37 |
-
btn = gr.Button("Awaaz Banayein", variant="primary")
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
btn.
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import edge_tts
|
| 3 |
+
import asyncio
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
+
# Aapka Model Link
|
| 7 |
+
MODEL_LINK = "https://huggingface.co/spaces/Mujeeb26/Mujeebvoice/resolve/main/Mujeeb_Voice.pth"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
async def convert_to_mujeeb(text, pitch):
|
| 10 |
+
if not text: return None
|
|
|
|
| 11 |
|
| 12 |
+
# 1. Pehle Edge-TTS se saaf Urdu/Sindhi awaaz banegi
|
| 13 |
communicate = edge_tts.Communicate(text, "ur-PK-AsadNeural")
|
| 14 |
+
await communicate.save("temp_base.mp3")
|
| 15 |
|
| 16 |
+
# 2. Yahan RVC Engine aapki .pth file apply karega
|
| 17 |
+
# NOTE: Abhi hum sirf base sun rahe hain, .pth apply karne ke liye
|
| 18 |
+
# humein 'vc_infer' function ko call karna hai.
|
| 19 |
+
return "temp_base.mp3"
|
| 20 |
|
| 21 |
+
with gr.Blocks() as demo:
|
| 22 |
+
gr.Markdown("# 🎙️ Mujeeb AI Voice (Final Phase)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
input_text = gr.Textbox(label="Sindhi/Urdu Text", value="توھان ڪيئن آھيو؟")
|
| 25 |
+
pitch_slider = gr.Slider(minimum=-12, maximum=12, value=0, label="Awaaz Bhaari ya Patli Karein (Pitch)")
|
| 26 |
+
btn = gr.Button("Mujeeb ki Awaaz Banayein")
|
| 27 |
+
output_audio = gr.Audio(label="Result")
|
| 28 |
+
|
| 29 |
+
btn.click(convert_to_mujeeb, inputs=[input_text, pitch_slider], outputs=output_audio)
|
| 30 |
|
| 31 |
demo.launch()
|