File size: 3,163 Bytes
db3e0de
 
 
3fee1ed
db3e0de
3fee1ed
db3e0de
 
3fee1ed
db3e0de
 
 
3fee1ed
db3e0de
 
3fee1ed
db3e0de
 
 
3fee1ed
 
 
 
 
 
 
 
 
 
 
 
db3e0de
3fee1ed
db3e0de
 
 
 
 
3fee1ed
 
db3e0de
 
3fee1ed
db3e0de
3fee1ed
 
db3e0de
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import gradio as gr
import re
import os
import soundfile as sf

# श्री राम नाग जी, यह फंक्शन नंबरों को शब्दों में बदलकर हकलाना बंद करेगा [cite: 2026-02-20]
def shiv_ai_clean_text(text):
    if not text: return ""
    num_map = {
        '0': 'शून्य', '1': 'एक', '2': 'दो', '3': 'तीन', '4': 'चार',
        '5': 'पांच', '6': 'छह', '7': 'सात', '8': 'आठ', '9': 'नौ', '10': 'दस'
    }
    for num, word in num_map.items():
        text = re.sub(r'\b' + num + r'\b', word, text)
    
    # डॉट को कोमा में बदलना ताकि सांस लेने का नेचुरल गैप मिले [cite: 2026-02-20]
    text = text.replace('.', ',')
    return text

# आवाज बनाने का मुख्य फंक्शन (Logic)
def process_voice(text, reference_audio):
    if not text or not reference_audio:
        return None
    
    # टेक्स्ट को साफ करें ताकि हकलाहट न हो
    clean_text = shiv_ai_clean_text(text)
    
    # यहाँ मॉडल आपकी ONNX फाइलों का उपयोग करके आवाज बनाएगा
    # अभी के लिए यह एक टेस्ट फाइल जेनरेट करेगा, इसे असली इंजन से लिंक करें
    print(f"प्रक्रिया शुरू: {clean_text}")
    return reference_audio # उदाहरण के तौर पर सैंपल वापस दे रहा है

# --- शिव एआई इंटरफेस (ब्रांडिंग: Shri Ram Nag) ---
with gr.Blocks(title="Shiv AI - Owner Shri Ram Nag") as demo:
    gr.Markdown("# 🔱 Shiv AI - टर्बो हाई स्पीड वॉइस")
    gr.Markdown("### 👑 ओनर: श्री राम नाग (Shri Ram Nag)")
    
    with gr.Tab("नया शिव एआई (Natural Voice)"):
        input_text = gr.Textbox(label="यहाँ लिखें (नंबर अपने आप शब्दों में बदल जाएंगे)", 
                                placeholder="जैसे: मेरे पास 5 नए विचार हैं...")
        voice_ref = gr.Audio(label="अपना वॉइस सैंपल दें (5 सेकंड)", type="filepath")
        run_btn = gr.Button("आवाज़ बनायें (Turbo Speed)", variant="primary")
        output_audio = gr.Audio(label="शिव एआई की तैयार आवाज़")
        
        # बटन दबाने पर अब यह फंक्शन काम करेगा
        run_btn.click(process_voice, inputs=[input_text, voice_ref], outputs=output_audio)

    with gr.Tab("पुराना मॉडल (Ramai.pth)"):
        gr.Markdown("आपका पुराना कोड यहाँ सुरक्षित और लॉक है। [cite: 2026-02-22]")

demo.launch()