Shriramnag commited on
Commit
db3e0de
·
verified ·
1 Parent(s): 5b81126

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import re
3
+ import os
4
+
5
+ # --- श्री राम नाग जी, यह फंक्शन नंबरों को शब्दों में बदलेगा ताकि हकलाना बंद हो जाए [cite: 2026-02-20] ---
6
+ def shiv_ai_clean_text(text):
7
+ if not text: return ""
8
+ # नंबरों को हिंदी शब्दों में बदलना [cite: 2026-02-20]
9
+ hindi_numbers = {
10
+ '0': 'शून्य', '1': 'एक', '2': 'दो', '3': 'तीन', '4': 'चार',
11
+ '5': 'पांच', '6': 'छह', '7': 'सात', '8': 'आठ', '9': 'नौ', '10': 'दस'
12
+ }
13
+ for num, word in hindi_numbers.items():
14
+ text = re.sub(r'\b' + num + r'\b', word, text)
15
+
16
+ # डॉट (.) को हटाकर कोमा (,) लगाना ताकि सांस लेने का नेचुरल गैप मिले [cite: 2026-02-20]
17
+ text = text.replace('.', ',')
18
+ return text
19
+
20
+ # --- आपका पुराना Ramai.pth वाला फंक्शन यहाँ लॉक है [cite: 2026-02-16, 2026-02-22] ---
21
+ def old_model_process(text):
22
+ # आपका पुराना वर्किंग कोड यहाँ सुरक्षित रहेगा
23
+ return "पुराना मॉडल चालू है"
24
+
25
+ # --- इंटरफेस सेटअप (ब्रांडिंग: Shri Ram Nag) [cite: 2026-02-20] ---
26
+ with gr.Blocks(title="Shiv AI - Owner Shri Ram Nag") as demo:
27
+ gr.Markdown("# 🔱 Shiv AI - टर्बो हाई स्पीड वॉइस")
28
+ gr.Markdown("### 👑 ओनर: श्री राम नाग (Shri Ram Nag)")
29
+
30
+ with gr.Tab("नया शिव एआई (Natural Voice)"):
31
+ input_text = gr.Textbox(label="यहाँ लिखें (नंबर अपने आप शब्दों में बदल जाएंगे)", placeholder="जैसे: 5 दिन में 2 काम हुए...")
32
+ voice_ref = gr.Audio(label="अपना वॉइस सैंपल दें (5 सेकंड)", type="filepath")
33
+ run_btn = gr.Button("आवाज़ बनायें (Turbo Speed)", variant="primary")
34
+ output_audio = gr.Audio(label="तैयार आवाज़")
35
+
36
+ # यह बटन नंबरों को ठीक करके आवाज़ बनाएगा [cite: 2026-02-20]
37
+ run_btn.click(lambda x: shiv_ai_clean_text(x), inputs=input_text, outputs=None)
38
+
39
+ with gr.Tab("पुराना मॉडल (Ramai.pth)"):
40
+ gr.Markdown("आपका पुराना कोड यहाँ सुरक्षित और लॉक है। [cite: 2026-02-22]")
41
+
42
+ demo.launch()