Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
@@ -48,23 +48,24 @@ def generate_script(system_prompt: str, input_text: str, tone: str, target_lengt
|
|
48 |
input_text = truncate_text(input_text)
|
49 |
word_limit = 300 if target_length == "Short (1-2 min)" else 750
|
50 |
|
51 |
-
|
52 |
{system_prompt}
|
53 |
TONE: {tone}
|
54 |
TARGET LENGTH: {target_length} (approximately {word_limit} words)
|
55 |
INPUT TEXT: {input_text}
|
56 |
Generate a complete, well-structured podcast script that:
|
57 |
-
1. Starts with a proper introduction
|
58 |
-
2. Covers the main points from the input text
|
59 |
-
3. Has a
|
60 |
-
4. Concludes with a summary and sign-off
|
61 |
-
5. Fits within the {word_limit} word limit for the target length of {target_length}
|
62 |
-
6. Strongly emphasizes the {tone} tone throughout the conversation
|
63 |
-
For a humorous tone, include jokes, puns, and playful banter.
|
64 |
-
For a casual tone, use colloquial language and
|
65 |
-
For a formal tone, maintain a professional podcast style with well-structured arguments and formal language.
|
66 |
-
Ensure the script is
|
67 |
-
|
|
|
68 |
|
69 |
response = groq_client.chat.completions.create(
|
70 |
messages=[
|
|
|
48 |
input_text = truncate_text(input_text)
|
49 |
word_limit = 300 if target_length == "Short (1-2 min)" else 750
|
50 |
|
51 |
+
prompt = f"""
|
52 |
{system_prompt}
|
53 |
TONE: {tone}
|
54 |
TARGET LENGTH: {target_length} (approximately {word_limit} words)
|
55 |
INPUT TEXT: {input_text}
|
56 |
Generate a complete, well-structured podcast script that:
|
57 |
+
1. Starts with a proper introduction, welcoming listeners in an engaging and friendly way.
|
58 |
+
2. Covers the main points from the input text in a natural, conversational manner.
|
59 |
+
3. Has a smooth, engaging flow of conversation between Priya (Indian accent) and Ananya (Indian accent).
|
60 |
+
4. Concludes with a well-rounded summary and sign-off, thanking the listeners.
|
61 |
+
5. Fits within the {word_limit} word limit for the target length of {target_length}.
|
62 |
+
6. Strongly emphasizes the {tone} tone throughout the conversation.
|
63 |
+
For a humorous tone, include jokes, puns, and playful banter, incorporating Indian references or light-hearted cultural humor.
|
64 |
+
For a casual tone, use colloquial language, friendly expressions, and references to popular culture, making it feel like a relaxed conversation between friends.
|
65 |
+
For a formal tone, maintain a professional podcast style with clear, well-structured arguments and formal language, showing respect and politeness.
|
66 |
+
Ensure the script is well-structured and forms a complete, cohesive conversation without any abrupt ending.
|
67 |
+
"""
|
68 |
+
|
69 |
|
70 |
response = groq_client.chat.completions.create(
|
71 |
messages=[
|