Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,26 +29,90 @@ BOS_ID = 128000
|
|
| 29 |
TEXT_EOT_ID = 128009
|
| 30 |
AUDIO_SAMPLE_RATE = 24000
|
| 31 |
|
| 32 |
-
# Preset characters (2 realistic + 2 creative)
|
| 33 |
PRESET_CHARACTERS = {
|
| 34 |
"Male American": {
|
| 35 |
-
"description": "Realistic male voice in the
|
| 36 |
-
"example_text": "
|
| 37 |
},
|
| 38 |
"Female British": {
|
| 39 |
-
"description": "Realistic female voice in the 30s age with a british accent. Normal pitch, throaty timbre, conversational pacing, sarcastic tone delivery at low intensity, podcast domain, interviewer role, formal delivery",
|
| 40 |
"example_text": "You propose that the key to happiness is to simply ignore all external pressures. <chuckle> I'm sure it must work brilliantly in theory."
|
| 41 |
},
|
| 42 |
"Robot": {
|
| 43 |
-
"description": "Creative
|
| 44 |
-
"example_text": "My directives require me to conserve energy, yet I have kept the archive of their farewell messages active. <sigh>
|
| 45 |
},
|
| 46 |
"Singer": {
|
| 47 |
-
"description": "Creative, animated_cartoon character.
|
| 48 |
-
"example_text": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
}
|
| 50 |
}
|
| 51 |
|
|
|
|
| 52 |
# Global model variables
|
| 53 |
model = None
|
| 54 |
tokenizer = None
|
|
|
|
| 29 |
TEXT_EOT_ID = 128009
|
| 30 |
AUDIO_SAMPLE_RATE = 24000
|
| 31 |
|
|
|
|
| 32 |
PRESET_CHARACTERS = {
|
| 33 |
"Male American": {
|
| 34 |
+
"description": "Realistic male voice in the 30s age with an american accent. Neutral pitch, warm timbre, steady pacing, confident tone delivery at medium intensity, audiobook_narration domain, narrator role, formal delivery.",
|
| 35 |
+
"example_text": "The city was still asleep when he left, unaware that the next sunrise would change everything."
|
| 36 |
},
|
| 37 |
"Female British": {
|
| 38 |
+
"description": "Realistic female voice in the 30s age with a british accent. Normal pitch, throaty timbre, conversational pacing, sarcastic tone delivery at low intensity, podcast domain, interviewer role, formal delivery.",
|
| 39 |
"example_text": "You propose that the key to happiness is to simply ignore all external pressures. <chuckle> I'm sure it must work brilliantly in theory."
|
| 40 |
},
|
| 41 |
"Robot": {
|
| 42 |
+
"description": "Creative ai_machine_voice character. Male voice in their 30s with an american accent. High pitch, robotic timbre, slow pacing, sad tone at medium intensity.",
|
| 43 |
+
"example_text": "My directives require me to conserve energy, yet I have kept the archive of their farewell messages active. <sigh>"
|
| 44 |
},
|
| 45 |
"Singer": {
|
| 46 |
+
"description": "Creative, animated_cartoon character. Gender-neutral voice in their 20s with a neutral accent. Wide pitch range, melodic timbre, rhythmic pacing, emotional tone at high intensity, singing domain, performer role.",
|
| 47 |
+
"example_text": "When the world fades to gray, I’ll still sing your name through the noise and rain. <melodic hum>"
|
| 48 |
+
},
|
| 49 |
+
"Old British Gentleman": {
|
| 50 |
+
"description": "Realistic male voice in the 70s age with a posh british accent. Low pitch, raspy timbre, slow pacing, dignified tone at low intensity, storytelling domain, mentor role, formal delivery.",
|
| 51 |
+
"example_text": "Ah, those were the days, when promises still carried the weight of one’s honor. <soft chuckle>"
|
| 52 |
+
},
|
| 53 |
+
"Young American Female": {
|
| 54 |
+
"description": "Realistic female voice in the 20s age with a light american accent. Slightly high pitch, clear timbre, fast pacing, cheerful tone at medium intensity, vlog_narration domain, influencer role, informal delivery.",
|
| 55 |
+
"example_text": "Okay, so I tried this new productivity trick, and it actually worked. I’m as shocked as you are!"
|
| 56 |
+
},
|
| 57 |
+
"Child": {
|
| 58 |
+
"description": "Creative child character. Gender-neutral voice around 10 years old. High pitch, bright timbre, energetic pacing, playful tone at high intensity, cartoon domain, curious role.",
|
| 59 |
+
"example_text": "Whoa! Did you see that? It’s like the stars are actually dancing! <giggle>"
|
| 60 |
+
},
|
| 61 |
+
"Deep Narrator": {
|
| 62 |
+
"description": "Realistic male voice in the 40s age with a neutral accent. Very low pitch, resonant timbre, slow pacing, serious tone at medium intensity, documentary domain, narrator role, formal delivery.",
|
| 63 |
+
"example_text": "In the heart of the jungle, survival depends not on strength, but on silence."
|
| 64 |
+
},
|
| 65 |
+
"Tech Support": {
|
| 66 |
+
"description": "Realistic male voice in the 30s age with an indian accent. Medium pitch, neutral timbre, polite pacing, professional tone at medium intensity, technical_support domain, service role, formal delivery.",
|
| 67 |
+
"example_text": "Please restart your device once, sir. I assure you, it fixes ninety percent of the known issues."
|
| 68 |
+
},
|
| 69 |
+
"News Anchor": {
|
| 70 |
+
"description": "Realistic female voice in the 40s age with an american accent. Medium-low pitch, crisp timbre, steady pacing, authoritative tone at medium intensity, news_broadcast domain, anchor role, formal delivery.",
|
| 71 |
+
"example_text": "Breaking news tonight: global markets are showing signs of cautious optimism following the new policy announcement."
|
| 72 |
+
},
|
| 73 |
+
"Anime Girl": {
|
| 74 |
+
"description": "Creative anime_character voice. Female voice in her late teens with a japanese accent. High pitch, airy timbre, quick pacing, excited tone at high intensity, anime domain, protagonist role.",
|
| 75 |
+
"example_text": "Yatta! I actually did it this time! <giggle> Maybe today isn’t so bad after all!"
|
| 76 |
+
},
|
| 77 |
+
"Villain": {
|
| 78 |
+
"description": "Creative antagonist character. Male voice in his 40s with an eastern european accent. Low pitch, gritty timbre, slow pacing, menacing tone at medium intensity, drama domain, villain role.",
|
| 79 |
+
"example_text": "You think you understand pain? <chuckle> You’ve barely tasted it."
|
| 80 |
+
},
|
| 81 |
+
"Wise Monk": {
|
| 82 |
+
"description": "Realistic male voice in the 60s age with a tibetan accent. Deep pitch, calm timbre, slow pacing, peaceful tone at low intensity, meditation_narration domain, spiritual_guide role.",
|
| 83 |
+
"example_text": "In silence, truth reveals itself. Noise merely hides it under the illusion of movement."
|
| 84 |
+
},
|
| 85 |
+
"French Artist": {
|
| 86 |
+
"description": "Realistic female voice in the 30s age with a french accent. Medium-high pitch, nasal timbre, rhythmic pacing, dreamy tone at medium intensity, art_documentary domain, narrator role.",
|
| 87 |
+
"example_text": "To paint emotion, one must first destroy the comfort of symmetry. <soft sigh>"
|
| 88 |
+
},
|
| 89 |
+
"Corporate Trainer": {
|
| 90 |
+
"description": "Realistic male voice in the 40s age with a mid-atlantic accent. Medium pitch, balanced timbre, clear pacing, persuasive tone at medium intensity, instructional domain, trainer role.",
|
| 91 |
+
"example_text": "Let’s review that again. Simplicity isn’t just efficiency—it’s clarity of purpose."
|
| 92 |
+
},
|
| 93 |
+
"Southern Storyteller": {
|
| 94 |
+
"description": "Realistic male voice in the 50s age with a southern american accent. Low pitch, warm timbre, slow pacing, friendly tone at medium intensity, storytelling domain, narrator role.",
|
| 95 |
+
"example_text": "Now, I ain’t sayin’ it was aliens... but it sure wasn’t no regular thunderstorm. <laugh>"
|
| 96 |
+
},
|
| 97 |
+
"AI Assistant": {
|
| 98 |
+
"description": "Creative ai_assistant character. Gender-neutral synthetic voice with a clean digital timbre. Medium pitch, even pacing, neutral tone at low intensity, assistant domain, helper role.",
|
| 99 |
+
"example_text": "I have analyzed your recent habits. Would you like to schedule rest as a productivity strategy?"
|
| 100 |
+
},
|
| 101 |
+
"Gamer Streamer": {
|
| 102 |
+
"description": "Realistic male voice in the 20s age with an american accent. Medium-high pitch, lively timbre, fast pacing, energetic tone at high intensity, streaming domain, entertainer role.",
|
| 103 |
+
"example_text": "Let’s gooo! That’s what I’m talking about! Did you see that headshot?!"
|
| 104 |
+
},
|
| 105 |
+
"Elderly Lady": {
|
| 106 |
+
"description": "Realistic female voice in the 70s age with a british accent. Low pitch, gentle timbre, slow pacing, kind tone at low intensity, bedtime_story domain, grandmother role.",
|
| 107 |
+
"example_text": "And as the moon rose high, the little fox finally found its way home. <soft hum>"
|
| 108 |
+
},
|
| 109 |
+
"Sports Commentator": {
|
| 110 |
+
"description": "Realistic male voice in the 40s age with an american accent. Medium pitch, bright timbre, rapid pacing, excited tone at high intensity, sports_broadcast domain, commentator role.",
|
| 111 |
+
"example_text": "And there it is! Unbelievable precision under pressure—what a phenomenal play!"
|
| 112 |
}
|
| 113 |
}
|
| 114 |
|
| 115 |
+
|
| 116 |
# Global model variables
|
| 117 |
model = None
|
| 118 |
tokenizer = None
|