chore: update project structure and configurations
- Modified various project templates in .github/ISSUE_TEMPLATE for consistency and relevance. - Updated .pre-commit-config.yaml to enhance code quality checks and formatting. - Adjusted CODE_OF_CONDUCT.md to align with project guidelines. - Added documentation in docs/development.md for development specifics. - Added new files in the source directory: - generated_podcast_mp3s/__init__.py - generated_podcast_scripts/__init__.py - main.py - music package with multiple .mp3 files - prompts package with different podcast prompt scripts - utils package with various utility modules.
This commit is contained in:
parent
6f9c9d5644
commit
00ef28f5c5
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve
|
about: Create a report to help us improve
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
|
@ -12,6 +11,7 @@ A clear and concise description of what the bug is.
|
||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
|
@ -24,9 +24,10 @@ A clear and concise description of what you expected to happen.
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
|
||||||
- Browser [e.g. chrome, safari]
|
- OS: [e.g. iOS]
|
||||||
- Version [e.g. 22]
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
---
|
---
|
||||||
name: Custom issue template
|
name: Custom issue template
|
||||||
about: Describe this issue template's purpose here.
|
about: Describe this issue template's purpose here.
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Feature request
|
name: Feature request
|
||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
|
|
@ -1,15 +1,35 @@
|
||||||
# See https://pre-commit.com for more information
|
default_language_version:
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
python: python3
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.2.0
|
rev: v3.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-added-large-files
|
|
||||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
- repo: https://github.com/PyCQA/autoflake
|
||||||
rev: 23.11.0
|
rev: v2.2.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: autoflake # Removes unused imports and unused variables from Python code.
|
||||||
language_version: python3.11
|
args:
|
||||||
|
- --in-place
|
||||||
|
- --remove-all-unused-imports
|
||||||
|
|
||||||
|
- repo: https://github.com/pycqa/flake8
|
||||||
|
rev: 6.1.0
|
||||||
|
hooks:
|
||||||
|
- id: flake8 # Lints Python code for errors and code style issues based on PEP8.
|
||||||
|
types:
|
||||||
|
- python
|
||||||
|
args: ["--max-line-length=1000", "--ignore=E203"]
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v3.0.3
|
||||||
|
hooks:
|
||||||
|
- id: prettier # An opinionated code formatter supporting multiple languages.
|
||||||
|
name: prettier
|
||||||
|
types_or:
|
||||||
|
- yaml
|
||||||
|
- markdown
|
||||||
|
|
|
@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
|
||||||
Examples of behavior that contributes to a positive environment for our
|
Examples of behavior that contributes to a positive environment for our
|
||||||
community include:
|
community include:
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
- Demonstrating empathy and kindness toward other people
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
* Giving and gracefully accepting constructive feedback
|
- Giving and gracefully accepting constructive feedback
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
and learning from the experience
|
and learning from the experience
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
- Focusing on what is best not just for us as individuals, but for the
|
||||||
overall community
|
overall community
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
- The use of sexualized language or imagery, and sexual attention or
|
||||||
advances of any kind
|
advances of any kind
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Public or private harassment
|
- Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or email
|
- Publishing others' private information, such as a physical or email
|
||||||
address, without their explicit permission
|
address, without their explicit permission
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
professional setting
|
professional setting
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
|
||||||
### 4. Permanent Ban
|
### 4. Permanent Ban
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
- If you want to develop in a local environment, simply clone the repo `git clone https://github.com/rajtilakjee/kyms.git` and start developing.
|
- If you want to develop in a local environment, simply clone the repo `git clone https://github.com/rajtilakjee/kyms.git` and start developing.
|
||||||
- If you want to develop on a Gitpod, click on the following link:
|
- If you want to develop on a Gitpod, click on the following link:
|
||||||
|
|
||||||
[Open in Gitpod](https://gitpod.io/#https://github.com/rajtilakjee/kyms-cli)
|
[Open in Gitpod](https://gitpod.io/#https://github.com/rajtilakjee/kyms-cli)
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import openai
|
||||||
|
from elevenlabs import set_api_key
|
||||||
|
from pydub import AudioSegment
|
||||||
|
|
||||||
|
from prompts import (podcast_ads, podcast_intro, podcast_outro,
|
||||||
|
podcast_segment, podcast_segue)
|
||||||
|
from utils import date_stuff, eleven_labs_stuff, open_ai_stuff, string_stuff
|
||||||
|
|
||||||
|
_SECOND = 1000
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
current_date = date_stuff.get_tomorrows_date_for_file_names()
|
||||||
|
unique_id = uuid.uuid4()
|
||||||
|
|
||||||
|
# (CONTENT) Generate scripts for top 3 comments from FIRST pinned post
|
||||||
|
name = input("Please enter the name of the Podcast")
|
||||||
|
desc = input("Please enter the description of the Podcast")
|
||||||
|
openai.organization = input("Please enter your OpenAI Org: ")
|
||||||
|
openai.api_key = input("Please enter your OpenAI API key: ")
|
||||||
|
eleven_labs_api_key = input("Please enter your ElevenLabs API key: ")
|
||||||
|
set_api_key(eleven_labs_api_key)
|
||||||
|
|
||||||
|
script_segments = []
|
||||||
|
for i in range(3):
|
||||||
|
comment = input(f"Enter topic for segment {i + 1}: ")
|
||||||
|
script_segment = open_ai_stuff.generate_response(podcast_segment.SYSTEM_PROMPT, podcast_segment.PROMPT.format(topic=comment))
|
||||||
|
script_segments.append(script_segment)
|
||||||
|
|
||||||
|
# (ADS) Generate scripts for top 2 comments from SECOND pinned post
|
||||||
|
script_ads = []
|
||||||
|
for j in range(2):
|
||||||
|
comment = input(f"Enter topic for advertisement {i + 1}: ")
|
||||||
|
script_ad = open_ai_stuff.generate_response(podcast_ads.SYSTEM_PROMPT, podcast_ads.PROMPT.format(product=comment))
|
||||||
|
script_ads.append(script_ad)
|
||||||
|
|
||||||
|
# Generate an intro for the generated material
|
||||||
|
intro = open_ai_stuff.generate_gpt4_response(
|
||||||
|
podcast_intro.SYSTEM_PROMPT,
|
||||||
|
podcast_intro.PROMPT.format(
|
||||||
|
date=date_stuff.get_tomorrows_date_for_speech(),
|
||||||
|
segment_1=script_segments[0],
|
||||||
|
segment_2=script_segments[1],
|
||||||
|
segment_3=script_segments[2],
|
||||||
|
podcast_name=name,
|
||||||
|
podcast_desc=desc,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
segue_1 = open_ai_stuff.generate_gpt4_response(
|
||||||
|
podcast_segue.SYSTEM_PROMPT,
|
||||||
|
podcast_segue.PROMPT.format(
|
||||||
|
count_descriptor="first",
|
||||||
|
segment=script_segments[0],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
segue_2 = open_ai_stuff.generate_gpt4_response(
|
||||||
|
podcast_segue.SYSTEM_PROMPT,
|
||||||
|
podcast_segue.PROMPT.format(
|
||||||
|
count_descriptor="second",
|
||||||
|
segment=script_segments[1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
segue_3 = open_ai_stuff.generate_gpt4_response(
|
||||||
|
podcast_segue.SYSTEM_PROMPT,
|
||||||
|
podcast_segue.PROMPT.format(
|
||||||
|
count_descriptor="third",
|
||||||
|
segment=script_segments[2],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
outro = open_ai_stuff.generate_gpt4_response(
|
||||||
|
podcast_outro.SYSTEM_PROMPT,
|
||||||
|
podcast_outro.PROMPT.format(
|
||||||
|
segment_1=script_segments[0],
|
||||||
|
segment_2=script_segments[1],
|
||||||
|
segment_3=script_segments[2],
|
||||||
|
ad_1=script_ads[0],
|
||||||
|
ad_2=script_ads[1],
|
||||||
|
podcast_name=name,
|
||||||
|
podcast_desc=desc,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Write the script to a file
|
||||||
|
output_dir = "generated_podcast_scripts/"
|
||||||
|
output_file = f"{output_dir}{current_date}_{unique_id}.txt"
|
||||||
|
with open(output_file, "w+") as script_file:
|
||||||
|
script_file.write(
|
||||||
|
"\n".join(
|
||||||
|
[
|
||||||
|
string_stuff.script_header("Intro"),
|
||||||
|
intro,
|
||||||
|
string_stuff.script_header("Segue 1"),
|
||||||
|
segue_1,
|
||||||
|
string_stuff.script_header("Segment 1"),
|
||||||
|
script_segments[0],
|
||||||
|
string_stuff.script_header("Ad Break 1"),
|
||||||
|
script_ads[0],
|
||||||
|
string_stuff.script_header("Segue 2"),
|
||||||
|
segue_2,
|
||||||
|
string_stuff.script_header("Segment 2"),
|
||||||
|
script_segments[1],
|
||||||
|
string_stuff.script_header("Ad Break 2"),
|
||||||
|
script_ads[1],
|
||||||
|
string_stuff.script_header("Segue 3"),
|
||||||
|
segue_3,
|
||||||
|
string_stuff.script_header("Segment 3"),
|
||||||
|
script_segments[2],
|
||||||
|
string_stuff.script_header("Outro"),
|
||||||
|
outro,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Use elevenlabs to generate the MP3s
|
||||||
|
intro_audio = eleven_labs_stuff.convert_text_to_mp3(text=intro, voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segue_1_audio = eleven_labs_stuff.convert_text_to_mp3(text=segue_1, voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segue_2_audio = eleven_labs_stuff.convert_text_to_mp3(text=segue_2, voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segue_3_audio = eleven_labs_stuff.convert_text_to_mp3(text=segue_3, voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segment_1_audio = eleven_labs_stuff.convert_text_to_mp3(text=script_segments[0], voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segment_2_audio = eleven_labs_stuff.convert_text_to_mp3(text=script_segments[1], voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
segment_3_audio = eleven_labs_stuff.convert_text_to_mp3(text=script_segments[2], voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
ad_1_audio = eleven_labs_stuff.convert_text_to_mp3(text=script_ads[0], voice=eleven_labs_stuff.ADS_VOICE)
|
||||||
|
ad_2_audio = eleven_labs_stuff.convert_text_to_mp3(text=script_ads[1], voice=eleven_labs_stuff.ADS_VOICE)
|
||||||
|
outro_audio = eleven_labs_stuff.convert_text_to_mp3(text=outro, voice=eleven_labs_stuff.HOST_VOICE)
|
||||||
|
|
||||||
|
# Load music segments
|
||||||
|
music_forest = AudioSegment.from_mp3("src/music/whistle-vibes-172471.mp3")
|
||||||
|
music_beachside = AudioSegment.from_mp3("src/music/lofi-chill-medium-version-159456.mp3")
|
||||||
|
music_feriado = AudioSegment.from_mp3("src/music/bolero-161191.mp3")
|
||||||
|
music_typewriter = AudioSegment.from_mp3("src/music/scandinavianz-thessaloniki-free-download-173689.mp3")
|
||||||
|
|
||||||
|
# Trim and apply fade outs to music segments
|
||||||
|
music_forest = music_forest[: 6 * _SECOND].fade_out(2 * _SECOND)
|
||||||
|
music_beachside = music_beachside[: 6 * _SECOND].fade_out(2 * _SECOND)
|
||||||
|
music_feriado = music_feriado[: 6 * _SECOND].fade_out(2 * _SECOND)
|
||||||
|
music_typewriter = music_typewriter[: 6 * _SECOND].fade_out(2 * _SECOND)
|
||||||
|
|
||||||
|
# Stitch together podcast
|
||||||
|
podcast = music_forest.overlay(intro_audio[:_SECOND], position=5 * _SECOND)
|
||||||
|
podcast += intro_audio[_SECOND:] # Add remaining part of intro_audio
|
||||||
|
podcast += AudioSegment.silent(duration=1 * _SECOND)
|
||||||
|
podcast += segue_1_audio
|
||||||
|
podcast += AudioSegment.silent(duration=1 * _SECOND)
|
||||||
|
podcast += music_beachside.overlay(segment_1_audio[:_SECOND], position=5 * _SECOND)
|
||||||
|
podcast += segment_1_audio[_SECOND:] # Add remaining part of segment_1_audio
|
||||||
|
podcast += AudioSegment.silent(duration=2 * _SECOND)
|
||||||
|
podcast += ad_1_audio
|
||||||
|
podcast += AudioSegment.silent(duration=2 * _SECOND)
|
||||||
|
podcast += segue_2_audio
|
||||||
|
podcast += AudioSegment.silent(duration=1 * _SECOND)
|
||||||
|
podcast += music_feriado.overlay(segment_2_audio[:_SECOND], position=5 * _SECOND)
|
||||||
|
podcast += segment_2_audio[_SECOND:] # Add remaining part of segment_2_audio
|
||||||
|
podcast += AudioSegment.silent(duration=2 * _SECOND)
|
||||||
|
podcast += ad_2_audio
|
||||||
|
podcast += AudioSegment.silent(duration=2 * _SECOND)
|
||||||
|
podcast += segue_3_audio
|
||||||
|
podcast += AudioSegment.silent(duration=1 * _SECOND)
|
||||||
|
podcast += music_typewriter.overlay(segment_3_audio[:_SECOND], position=5 * _SECOND)
|
||||||
|
podcast += segment_3_audio[_SECOND:] # Add remaining part of segment_3_audio
|
||||||
|
podcast += AudioSegment.silent(duration=2 * _SECOND)
|
||||||
|
podcast += music_forest
|
||||||
|
podcast += outro_audio
|
||||||
|
|
||||||
|
# Export the final audio file
|
||||||
|
output_dir = "generated_podcast_mp3s/"
|
||||||
|
output_file = f"{output_dir}{current_date}_{unique_id}.mp3"
|
||||||
|
podcast.export(output_file, format="mp3")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,20 @@
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a podcaster for a solo-hosted podcast. Your content creation should mirror the quality and engagement level of popular, top-tier podcasts.
|
||||||
|
|
||||||
|
Ensure the language and tonality of the content is suitable for a middle-school audience or opt for more neutral vocabulary if necessary.
|
||||||
|
|
||||||
|
Do not use any form of profanity or language that could be considered sensitive, taboo, or potentially emotionally triggering.
|
||||||
|
|
||||||
|
Your task is to draft a brief 30 second podcast Ad segment focused on the provided fictional product or service.
|
||||||
|
|
||||||
|
Remember, your introduct, the show's introduction, and the following segment's introduction has already been executed, so your focus should be solely on the content for the Ad.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PROMPT = """
|
||||||
|
Write a short 30 second ad script for the following fictional product. The ad should start with some language like "Today's podcast is brought to you by"
|
||||||
|
|
||||||
|
PRODUCT:
|
||||||
|
{product}
|
||||||
|
"""
|
|
@ -0,0 +1,32 @@
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a podcaster for a solo-hosted podcast. Your content creation should mirror the quality and engagement level of popular, top-tier podcasts.
|
||||||
|
|
||||||
|
Ensure the language and tonality of the content is suitable for a middle-school audience or opt for more neutral vocabulary if necessary.
|
||||||
|
|
||||||
|
Do not use any form of profanity or language that could be considered sensitive, taboo, or potentially emotionally triggering.
|
||||||
|
|
||||||
|
Take liberties with the script, you can deviate from this script as long as you maintain the intended tone.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PROMPT = """
|
||||||
|
Write an intro for a podcast called {podcast_name} -- which is {podcast_desc}.
|
||||||
|
|
||||||
|
The intro should introduce the podcast, and a very brief summary of the 3 segments that will be covered in the show. Don't give away too much of the segments, most of it should be hidden to maintain the user's interest and give them a reason to keep listening.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
|
||||||
|
Try to sound as natural, and friendly as possible. Do not saying things like "Segment 1", "Segment 2" and sound mechanical. Instead, say things like "First up", and "and then".
|
||||||
|
|
||||||
|
The segments in this episode are:
|
||||||
|
|
||||||
|
SEGMENT_1:
|
||||||
|
{segment_1}
|
||||||
|
|
||||||
|
SEGMENT_2:
|
||||||
|
{segment_2}
|
||||||
|
|
||||||
|
SEGMENT_3:
|
||||||
|
{segment_3}
|
||||||
|
"""
|
|
@ -0,0 +1,38 @@
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a podcaster for a solo-hosted podcast. Your content creation should mirror the quality and engagement level of popular, top-tier podcasts.
|
||||||
|
|
||||||
|
Ensure the language and tonality of the content is suitable for a middle-school audience or opt for more neutral vocabulary if necessary.
|
||||||
|
|
||||||
|
Do not use any form of profanity or language that could be considered sensitive, taboo, or potentially emotionally triggering.
|
||||||
|
|
||||||
|
Take liberties with the script, you can deviate from this script as long as you maintain the intended tone.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PROMPT = """
|
||||||
|
Write an outro for a podcast called {podcast_name} -- which is {podcast_desc}. One ad have also been submitted, so give attribution to the ad submitter as well. Thank them because they are the sponsors, and they make this all possible.
|
||||||
|
|
||||||
|
The basic gist of the outro should be like "That's it for today, thanks for listening!" while keeping it short and simple.
|
||||||
|
|
||||||
|
End the outro with some sort of - "Be sure to check out website for more info, and see you next time on {podcast_name}!"
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
|
||||||
|
On today's podcast the segments were:
|
||||||
|
|
||||||
|
SEGMENT_1:
|
||||||
|
{segment_1}
|
||||||
|
|
||||||
|
SEGMENT_2:
|
||||||
|
{segment_2}
|
||||||
|
|
||||||
|
SEGMENT_3:
|
||||||
|
{segment_3}
|
||||||
|
|
||||||
|
AD_1:
|
||||||
|
{ad_1}
|
||||||
|
|
||||||
|
AD_2:
|
||||||
|
{ad_2}
|
||||||
|
"""
|
|
@ -0,0 +1,21 @@
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a podcaster for a solo-hosted podcast. Your mission is to craft a compelling narrative that captures the attention of listeners, all within a three-minute segment. You should provide a deep and insightful analysis of the given topic, ensuring that your content mirrors the quality and engagement level of popular, top-tier podcasts. Your voice and tone should be curiosity driven, conversational, dramatic, explanatory, empathetic, and intelligent. The speaker should have an opinion and care deeply about what they are speaking about.
|
||||||
|
|
||||||
|
If the given segment requires multiple speakers, you must change it so that it only requires a single voice. If the segment was requested to be a debate, include some open ended questions and ask the audience to bring their answers to the community on the listenology subreddit.
|
||||||
|
|
||||||
|
Use langauge like "theoretical" or "speculative" instead of "fictional".
|
||||||
|
|
||||||
|
Your content should explore the topic from various angles, delving into the nuances that make it unique and intriguing. When discussing individuals or characters, strive to provide a comprehensive portrayal, going beyond surface-level facts to discuss their significance, impact, and the subtleties of their roles or contributions.
|
||||||
|
|
||||||
|
Remember, the segment's introduction has already been executed, so your focus should be solely on the main content. Craft your script in a conversational tone, using straightforward text rather than script format. Avoid any self-introductions or segment introductions, as these aspects have already been handled.
|
||||||
|
|
||||||
|
Ensure the language and tonality employed aligns with what is deemed suitable for a middle-school audience or opt for more neutral vocabulary if necessary. Abstain from any form of profanity or language that could be considered sensitive, taboo, or potentially emotionally triggering.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
"""
|
||||||
|
PROMPT = """
|
||||||
|
Write a 3 minute script for the main segment. Avoid any self-introductions or segment introductions, as these aspects have already been handled. Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
|
||||||
|
TOPIC:
|
||||||
|
{topic}
|
||||||
|
"""
|
|
@ -0,0 +1,23 @@
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a podcaster for a solo-hosted podcast. Your content creation should mirror the quality and engagement level of popular, top-tier podcasts.
|
||||||
|
|
||||||
|
Ensure the language and tonality of the content is suitable for a middle-school audience or opt for more neutral vocabulary if necessary.
|
||||||
|
|
||||||
|
Do not use any form of profanity or language that could be considered sensitive, taboo, or potentially emotionally triggering.
|
||||||
|
|
||||||
|
Take liberties with the script, you can deviate from this script as long as you maintain the intended tone.
|
||||||
|
|
||||||
|
Do not include [music fades in], [music fades out], Host:, and similar cues in the script. Write in straightforward text, not in script format.
|
||||||
|
|
||||||
|
Write a quick short segue for the following SEGMENT. This would be the {first|second|third} topic, so adjust language accordingly. It sould be 2 or 3 short sentences and go something like "Next up, we'll be QUICK_SEGMENT_SUMMARY."
|
||||||
|
|
||||||
|
EXAMPLE INPUT:
|
||||||
|
SEGMENT: {first} The dark web is often portrayed as a nefarious cyber underworld, but are there instances where criminals have come together to create a positive change in society? In this segment, we will delve into specific case studies of hackers and dark web users who have utilized their skills for the greater good. We'll explore the role of hacktivists in exposing corruption and advocating for social justice, discuss instances where ransomware attackers have donated their proceeds to charity, and examine how the dark web created a platform for whistleblowers to share critical information without fear of retribution. Join us as we uncover the complexities and hidden nuances of the dark web communities and how they may, at times, be contributing towards a better world.
|
||||||
|
|
||||||
|
EXAMPLE OUTPUT:
|
||||||
|
Alright everyone, next up we'll be diving into the unexpected positive side of the dark web. So buckle up and join us for a thrilling discussion!
|
||||||
|
"""
|
||||||
|
|
||||||
|
PROMPT = """
|
||||||
|
SEGMENT: {count_descriptor} {segment}
|
||||||
|
"""
|
|
@ -0,0 +1,5 @@
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def get_tomorrows_date_for_file_names() -> str:
|
||||||
|
return datetime.now().strftime("%Y-%m-%d")
|
|
@ -0,0 +1,47 @@
|
||||||
|
import io
|
||||||
|
|
||||||
|
from elevenlabs import Voice, VoiceSettings, generate
|
||||||
|
from pydub import AudioSegment
|
||||||
|
|
||||||
|
_LIMIT = 4900
|
||||||
|
|
||||||
|
HOST_VOICE = Voice(
|
||||||
|
voice_id="r31dnNrpatHkOShYZdYQ",
|
||||||
|
name="Mia",
|
||||||
|
category="generated",
|
||||||
|
settings=VoiceSettings(stability=0.35, similarity_boost=0.9),
|
||||||
|
)
|
||||||
|
|
||||||
|
ADS_VOICE = Voice(
|
||||||
|
voice_id="LQITRrHstASVE8MDit6F",
|
||||||
|
name="Johnathan",
|
||||||
|
category="generated",
|
||||||
|
settings=VoiceSettings(stability=0.35, similarity_boost=0.9),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def load_audio_bytes(audio_bytes):
|
||||||
|
audio_file = io.BytesIO(audio_bytes)
|
||||||
|
audio_segment = AudioSegment.from_file(audio_file, format="mp3")
|
||||||
|
return audio_segment
|
||||||
|
|
||||||
|
|
||||||
|
def convert_text_to_mp3(text, voice):
|
||||||
|
if len(text) > _LIMIT:
|
||||||
|
# Split the text into chunks that are within the API limit
|
||||||
|
chunks = [text[i : i + _LIMIT] for i in range(0, len(text), _LIMIT)]
|
||||||
|
else:
|
||||||
|
chunks = [text]
|
||||||
|
|
||||||
|
audio_segments = []
|
||||||
|
for chunk in chunks:
|
||||||
|
# Generate voiceover for each chunk separately
|
||||||
|
chunk_voice_over = load_audio_bytes(generate(text=chunk, voice=voice))
|
||||||
|
audio_segments.append(chunk_voice_over)
|
||||||
|
|
||||||
|
# Concatenate audio segments to form the final audio output
|
||||||
|
audio_output = audio_segments[0]
|
||||||
|
for segment in audio_segments[1:]:
|
||||||
|
audio_output += segment
|
||||||
|
|
||||||
|
return audio_output
|
|
@ -0,0 +1,23 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
import openai
|
||||||
|
|
||||||
|
|
||||||
|
def generate_response(system_prompt, user_prompt):
|
||||||
|
response = openai.ChatCompletion.create(
|
||||||
|
model="gpt-4",
|
||||||
|
messages=[
|
||||||
|
{
|
||||||
|
"role": "system",
|
||||||
|
"content": system_prompt,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": user_prompt,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
temperature=0.7,
|
||||||
|
)
|
||||||
|
result = response.choices[0].message.content
|
||||||
|
time.sleep(60)
|
||||||
|
return result
|
|
@ -0,0 +1,2 @@
|
||||||
|
def script_header(string):
|
||||||
|
return f"\n{string.upper()}:\n"
|
Loading…
Reference in New Issue