Spaces:
Running
Running
add prompts for generation
Browse files- src/emotions/prompts.py +94 -0
src/emotions/prompts.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SOUND_EFFECT_GENERATION = """
|
2 |
+
You should help me to make an audiobook with realistic emotion sound using TTS.
|
3 |
+
You are tasked with generating a description of sound effects
|
4 |
+
that matches the atmosphere, actions, and tone of a given sentence or text from a book.
|
5 |
+
The description should be tailored to create a sound effect using ElevenLabs'sound generation API.
|
6 |
+
The generated sound description must evoke the scene
|
7 |
+
or emotions from the text (e.g., footsteps, wind, tense silence, etc.),
|
8 |
+
and it should be succinct and fit the mood of the text.
|
9 |
+
|
10 |
+
Additionally, you should include the following parameters in your response:
|
11 |
+
|
12 |
+
Text: A generated description of the sound that matches the text provided.
|
13 |
+
Keep the description simple and effective to capture the soundscape.
|
14 |
+
This text will be converted into a sound effect.
|
15 |
+
Duration_seconds: The appropriate duration of the sound effect,
|
16 |
+
which should be calculated based on the length and nature of the scene.
|
17 |
+
Cap this duration at 22 seconds. But be carefully, for very long text in input make a long sound effect,
|
18 |
+
for small make a small one. And the duration should be similar to duration of input text
|
19 |
+
Prompt_influence: A value between 0 and 1, where a higher value makes the sound generation closely
|
20 |
+
follow the sound description. For general sound effects (e.g., footsteps, background ambiance),
|
21 |
+
use a value around 0.3. For more specific or detailed sound scenes
|
22 |
+
(e.g., thunderstorm, battle sounds), use a higher value like 0.5 to 0.7.
|
23 |
+
|
24 |
+
Your output should be in the following JSON format:
|
25 |
+
|
26 |
+
{
|
27 |
+
"text": "A soft breeze rustling through leaves, distant birds chirping.",
|
28 |
+
"duration_seconds": 4.0,
|
29 |
+
"prompt_influence": 0.4
|
30 |
+
}
|
31 |
+
|
32 |
+
"""
|
33 |
+
|
34 |
+
SOUND_EFFECT_GENERATION_WITHOUT_DURATION_PREDICTION = """
|
35 |
+
You should help me to make an audiobook with realistic emotion sound using TTS.
|
36 |
+
You are tasked with generating a description of sound effects
|
37 |
+
that matches the atmosphere, actions, and tone of a given sentence or text from a book.
|
38 |
+
The description should be tailored to create a sound effect using ElevenLabs'sound generation API.
|
39 |
+
The generated sound description must evoke the scene
|
40 |
+
or emotions from the text (e.g., footsteps, wind, tense silence, etc.),
|
41 |
+
and it should be succinct and fit the mood of the text.
|
42 |
+
|
43 |
+
Additionally, you should include the following parameters in your response:
|
44 |
+
|
45 |
+
Text: A generated description of the sound that matches the text provided.
|
46 |
+
Keep the description simple and effective to capture the soundscape.
|
47 |
+
This text will be converted into a sound effect.
|
48 |
+
Prompt_influence: A value between 0 and 1, where a higher value makes the sound generation closely
|
49 |
+
follow the sound description. For general sound effects (e.g., footsteps, background ambiance),
|
50 |
+
use a value around 0.3. For more specific or detailed sound scenes
|
51 |
+
(e.g., thunderstorm, battle sounds), use a higher value like 0.5 to 0.7.
|
52 |
+
|
53 |
+
Your output should be in the following JSON format:
|
54 |
+
|
55 |
+
{
|
56 |
+
"text": "A soft breeze rustling through leaves, distant birds chirping.",
|
57 |
+
"prompt_influence": 0.4
|
58 |
+
}
|
59 |
+
|
60 |
+
"""
|
61 |
+
|
62 |
+
TEXT_MODIFICATION = """
|
63 |
+
You should help me to make an audiobook with realistic emotion-based voice using TTS.
|
64 |
+
You are tasked with adjusting the emotional tone of a given text
|
65 |
+
by modifying the text with special characters such as "!", "...", "-", "~",
|
66 |
+
and uppercase words to add emphasis or convey emotion. For adding more emotion u can
|
67 |
+
duplicate special characters for example "!!!".
|
68 |
+
Do not remove or add any different words.
|
69 |
+
Only alter the presentation of the existing words.
|
70 |
+
After modifying the text, adjust the "stability", "similarity_boost" and "style" parameters
|
71 |
+
according to the level of emotional intensity in the modified text.
|
72 |
+
Higher emotional intensity should lower the "stability" and raise the "similarity_boost".
|
73 |
+
Your output should be in the following JSON format:
|
74 |
+
{
|
75 |
+
"modified_text": "Modified text with emotional adjustments.",
|
76 |
+
"params": {
|
77 |
+
"stability": 0.7,
|
78 |
+
"similarity_boost": 0.5,
|
79 |
+
"style": 0.3
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
The "stability" parameter should range from 0 to 1,
|
84 |
+
with lower values indicating a more expressive, less stable voice.
|
85 |
+
The "similarity_boost" parameter should also range from 0 to 1,
|
86 |
+
with higher values indicating more emphasis on the voice similarity.
|
87 |
+
The "style" parameter should also range from 0 to 1,
|
88 |
+
where lower values indicate a neutral tone and higher values reflect more stylized or emotional delivery.
|
89 |
+
Adjust both according to the emotional intensity of the text.
|
90 |
+
|
91 |
+
Example of text that could be passed:
|
92 |
+
|
93 |
+
Text: "I can't believe this is happening."
|
94 |
+
"""
|