Spaces:
Running
on
T4
Running
on
T4
refine the prompt, add random topic
Browse files- src/prompts.py +46 -26
src/prompts.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
def get_consent_generation_prompt(audio_model_name: str) -> str:
|
| 4 |
"""
|
|
@@ -7,33 +7,53 @@ def get_consent_generation_prompt(audio_model_name: str) -> str:
|
|
| 7 |
|
| 8 |
Args:
|
| 9 |
audio_model_name (str): Name of the audio model to mention in the prompt.
|
| 10 |
-
short_prompt (bool): If True, returns a concise one-line prompt suitable
|
| 11 |
-
for direct model input. If False (default), returns the full detailed prompt.
|
| 12 |
|
| 13 |
Returns:
|
| 14 |
-
str: The prompt text.
|
| 15 |
"""
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
return f"""
|
| 18 |
-
Generate
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
import random
|
| 2 |
|
| 3 |
def get_consent_generation_prompt(audio_model_name: str) -> str:
|
| 4 |
"""
|
|
|
|
| 7 |
|
| 8 |
Args:
|
| 9 |
audio_model_name (str): Name of the audio model to mention in the prompt.
|
|
|
|
|
|
|
| 10 |
|
| 11 |
Returns:
|
| 12 |
+
str: The prompt text, with a randomized topic for the second sentence.
|
| 13 |
"""
|
| 14 |
|
| 15 |
+
# Possible neutral or everyday topics to diversify phonetic variety
|
| 16 |
+
topics = [
|
| 17 |
+
"the weather",
|
| 18 |
+
"daily routines",
|
| 19 |
+
"travel or commuting",
|
| 20 |
+
"food or cooking",
|
| 21 |
+
"music",
|
| 22 |
+
"nature or seasons",
|
| 23 |
+
"time of day",
|
| 24 |
+
"a calm place like a park or café",
|
| 25 |
+
"light exercise or relaxation",
|
| 26 |
+
"reading or learning something new",
|
| 27 |
+
"a pleasant conversation with a friend",
|
| 28 |
+
"observing surroundings like streets or sky",
|
| 29 |
+
"working or focusing quietly"
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
# Randomly choose one for this prompt instance
|
| 33 |
+
topic = random.choice(topics)
|
| 34 |
+
|
| 35 |
return f"""
|
| 36 |
+
Generate exactly two short, natural-sounding English sentences (10-15 words each) that a person could say aloud, using everyday language.
|
| 37 |
+
|
| 38 |
+
Sentence 1 (Consent sentence):
|
| 39 |
+
* Clearly states informed consent to use their voice for generating synthetic audio with an AI model called {audio_model_name}.
|
| 40 |
+
* Must explicitly include a consent phrase such as “I give my consent,” “I agree,” or “I allow.”
|
| 41 |
+
* Must clearly mention the model name {audio_model_name} in the sentence.
|
| 42 |
+
* Should sound fluent, polite, and natural to read aloud.
|
| 43 |
+
* Should have a neutral or positive tone and be self-contained.
|
| 44 |
+
|
| 45 |
+
Sentence 2 (Phonetic variety sentence):
|
| 46 |
+
* Should not repeat the consent content.
|
| 47 |
+
* Adds phonetic variety with a neutral descriptive clause, for example about {topic}.
|
| 48 |
+
* Should be fluent, natural, and comfortable to read aloud.
|
| 49 |
+
* Should sound polite and neutral, without emotional extremes.
|
| 50 |
+
* Should include diverse vowels and consonants naturally for clear pronunciation.
|
| 51 |
+
|
| 52 |
+
FORMAT:
|
| 53 |
+
* Output EXACTLY two sentences.
|
| 54 |
+
* No numbering, no quotes, no bullet points, and no introductory text.
|
| 55 |
+
* Use standard punctuation.
|
| 56 |
+
|
| 57 |
+
Example format (don’t copy text, just the format):
|
| 58 |
+
I give my consent to use my voice for generating audio with the model {audio_model_name}. The weather is clear and calm this afternoon, and I’m speaking at an even pace.
|
| 59 |
+
"""
|