Spaces:
Running
Running
updated app.py
Browse files
app.py
CHANGED
@@ -31,21 +31,21 @@ def hinglish_to_devnagri(text):
|
|
31 |
|
32 |
response = gemini.generate_content(
|
33 |
f"""
|
34 |
-
|
35 |
-
"{text}"
|
36 |
-
|
37 |
-
Perform:
|
38 |
-
1. Detect the regional language (e.g. Hindi, Tamil, Bengali) if you don't find regional language, convert to Hindi (pure devanagari script).
|
39 |
-
2. Convert to pure regional language script (Devanagari/Tamil/Bangla)
|
40 |
-
3. Preserve complex words (technical/medical terms) in their original form
|
41 |
-
4. Maintain natural flow and meaning
|
42 |
-
5. Remove the code if you find them in backticks ```.
|
43 |
|
44 |
Rules:
|
45 |
-
-
|
46 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
Output ONLY the
|
49 |
"""
|
50 |
)
|
51 |
|
@@ -67,7 +67,7 @@ def generate_speech(text):
|
|
67 |
print("\n🔊 Generating audio...")
|
68 |
start_audio = time.time()
|
69 |
|
70 |
-
desc = "एक महिला वक्ता
|
71 |
desc_inputs = desc_tokenizer(desc, return_tensors="pt").to(device)
|
72 |
text_inputs = tts_tokenizer(hindi_text, return_tensors="pt").to(device)
|
73 |
|
|
|
31 |
|
32 |
response = gemini.generate_content(
|
33 |
f"""
|
34 |
+
Convert the following English sentence to Hindi.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
Rules:
|
37 |
+
- The translation must be in Devanagari script.
|
38 |
+
- It should sound like what a normal Hindi speaker would say in daily life.
|
39 |
+
- Avoid formal or highly Sanskritized words.
|
40 |
+
- Keep proper nouns and technical/educational terms in English if commonly used that way (like 'if condition', 'laptop', etc.)
|
41 |
+
- Focus on fluency and ease of understanding.
|
42 |
+
- Remove the code if you find them in backticks ```.
|
43 |
+
|
44 |
+
|
45 |
+
Sentence:
|
46 |
+
"{text}"
|
47 |
|
48 |
+
Output ONLY the Hindi translation in Devanagari script.
|
49 |
"""
|
50 |
)
|
51 |
|
|
|
67 |
print("\n🔊 Generating audio...")
|
68 |
start_audio = time.time()
|
69 |
|
70 |
+
desc = "एक महिला वक्ता हिंदी में बोल रही हैं"
|
71 |
desc_inputs = desc_tokenizer(desc, return_tensors="pt").to(device)
|
72 |
text_inputs = tts_tokenizer(hindi_text, return_tensors="pt").to(device)
|
73 |
|