final tweaks to podcast

This commit is contained in:
LUIS NOVO 2024-11-13 21:46:15 -03:00
parent 4f9aa63b3e
commit dd99531b00
6 changed files with 20 additions and 21 deletions

View file

@ -52,12 +52,17 @@ class PodcastConfig(ObjectModel):
raise ValueError("Both voice1 and voice2 must be provided") raise ValueError("Both voice1 and voice2 must be provided")
return self return self
def generate_episode(self, episode_name, text, longform=False, instructions=None): def generate_episode(
self,
episode_name: str,
text: str,
instructions: str = "",
longform: bool = False,
):
self.user_instructions = ( self.user_instructions = (
instructions if instructions else self.user_instructions instructions if instructions else self.user_instructions
) )
conversation_config = { conversation_config = {
"longform": longform,
"conversation_style": self.conversation_style, "conversation_style": self.conversation_style,
"roles_person1": self.person1_role, "roles_person1": self.person1_role,
"roles_person2": self.person2_role, "roles_person2": self.person2_role,
@ -87,10 +92,6 @@ class PodcastConfig(ObjectModel):
}, },
} }
logger.debug(
f"Generating episode {episode_name} with config {conversation_config}"
)
api_key_label = None api_key_label = None
llm_model_name = None llm_model_name = None
if self.transcript_model_provider: if self.transcript_model_provider:
@ -104,12 +105,17 @@ class PodcastConfig(ObjectModel):
api_key_label = "GEMINI_API_KEY" api_key_label = "GEMINI_API_KEY"
llm_model_name = self.transcript_model llm_model_name = self.transcript_model
logger.debug(
f"Generating episode {episode_name} with config {conversation_config} and using model {llm_model_name}"
)
audio_file = generate_podcast( audio_file = generate_podcast(
conversation_config=conversation_config, conversation_config=conversation_config,
text=text, text=text,
tts_model=self.provider, tts_model=self.provider,
llm_model_name=llm_model_name, llm_model_name=llm_model_name,
api_key_label=api_key_label, api_key_label=api_key_label,
longform=longform,
) )
episode = PodcastEpisode( episode = PodcastEpisode(
name=episode_name, name=episode_name,

View file

@ -246,9 +246,6 @@ with templates_tab:
or pd_config.transcript_model or pd_config.transcript_model
not in transcript_provider_models[pd_config.transcript_model_provider] not in transcript_provider_models[pd_config.transcript_model_provider]
): ):
st.warning(
f"Transcript Model {pd_config.transcript_model} not setup. Changing to default."
)
index = 0 index = 0
else: else:
index = transcript_provider_models[ index = transcript_provider_models[
@ -268,9 +265,6 @@ with templates_tab:
key=f"provider_{pd_config.id}", key=f"provider_{pd_config.id}",
) )
if pd_config.model not in provider_models[pd_config.provider]: if pd_config.model not in provider_models[pd_config.provider]:
st.warning(
f"Audio Model {pd_config.model} not setup. Changing to default."
)
index = 0 index = 0
else: else:
index = provider_models[pd_config.provider].index(pd_config.model) index = provider_models[pd_config.provider].index(pd_config.model)

View file

@ -98,7 +98,7 @@ def chat_sidebar(current_notebook: Notebook, current_session: ChatSession):
with st.spinner("Go grab a coffee, almost there..."): with st.spinner("Go grab a coffee, almost there..."):
selected_template.generate_episode( selected_template.generate_episode(
episode_name=episode_name, episode_name=episode_name,
text=context, text=str(context),
longform=longform, longform=longform,
instructions=instructions, instructions=instructions,
) )

View file

@ -6,6 +6,5 @@ source_context_icons = [
note_context_icons = [ note_context_icons = [
"⛔ not in context", "⛔ not in context",
"🟡 summary",
"🟢 full content", "🟢 full content",
] ]

12
poetry.lock generated
View file

@ -2430,13 +2430,13 @@ six = "*"
[[package]] [[package]]
name = "langgraph" name = "langgraph"
version = "0.2.46" version = "0.2.47"
description = "Building stateful, multi-actor applications with LLMs" description = "Building stateful, multi-actor applications with LLMs"
optional = false optional = false
python-versions = "<4.0,>=3.9.0" python-versions = "<4.0,>=3.9.0"
files = [ files = [
{file = "langgraph-0.2.46-py3-none-any.whl", hash = "sha256:7ca4031bc8f06cb3697ccee21ca80464588656391d3888090b6790dd89bffad1"}, {file = "langgraph-0.2.47-py3-none-any.whl", hash = "sha256:597bad088c245741b79d46aea351df1b9bc0b2b127122c39ca2a7c0164e40b4f"},
{file = "langgraph-0.2.46.tar.gz", hash = "sha256:f1a39ba0d9b3df3b807b14015e682bc2b445ceb760d113e75ab34209a7eaadef"}, {file = "langgraph-0.2.47.tar.gz", hash = "sha256:23b6ea1fe5c6d57f510dee9a66fbc2cdb546ab6c13756fc28534343b36b7935f"},
] ]
[package.dependencies] [package.dependencies]
@ -3807,13 +3807,13 @@ files = [
[[package]] [[package]]
name = "podcastfy" name = "podcastfy"
version = "0.3.5" version = "0.3.6"
description = "An Open Source alternative to NotebookLM's podcast feature: Transforming Multimodal Content into Captivating Multilingual Audio Conversations with GenAI" description = "An Open Source alternative to NotebookLM's podcast feature: Transforming Multimodal Content into Captivating Multilingual Audio Conversations with GenAI"
optional = false optional = false
python-versions = "<4.0,>=3.11" python-versions = "<4.0,>=3.11"
files = [ files = [
{file = "podcastfy-0.3.5-py3-none-any.whl", hash = "sha256:c5aef31a1320800e5d22257ee763abb0e748a115112e1914084f5331462d1a32"}, {file = "podcastfy-0.3.6-py3-none-any.whl", hash = "sha256:8584fd044f63e236d30678a75188f5e7c7335170e24f80e647f7a480661e0c13"},
{file = "podcastfy-0.3.5.tar.gz", hash = "sha256:5b3111a28aaadd31c6e13983719996f05de7b70a7f656dd56ce6ed74e294e1ef"}, {file = "podcastfy-0.3.6.tar.gz", hash = "sha256:b4c787b999b4dda70504f99520802b0dfc99e76703089443a9b4a76c85bf5047"},
] ]
[package.dependencies] [package.dependencies]

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "open-notebook" name = "open-notebook"
version = "0.0.11" version = "0.1.0"
description = "An open source implementation of a research assistant, inspired by Google Notebook LM" description = "An open source implementation of a research assistant, inspired by Google Notebook LM"
authors = ["Luis Novo <lfnovo@gmail.com>"] authors = ["Luis Novo <lfnovo@gmail.com>"]
license = "MIT" license = "MIT"