From 79ee3aac8358666fdfe8c7311a9b18602ac87cdd Mon Sep 17 00:00:00 2001 From: Victor Miti Date: Mon, 5 Feb 2024 18:45:00 +0000 Subject: [PATCH] fix: address the too many articles problem --- app/core/podcast/content.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/core/podcast/content.py b/app/core/podcast/content.py index 0719f61a..497030e5 100644 --- a/app/core/podcast/content.py +++ b/app/core/podcast/content.py @@ -12,8 +12,7 @@ from pydantic import HttpUrl from app.core.db.models import Article, Episode - -# from app.core.summarization.backends.together import brief_summary +from app.core.summarization.backends.together import brief_summary from app.core.utilities import ( DATA_DIR, # OPENAI_API_KEY, @@ -95,13 +94,16 @@ def create_transcript(news: list[dict[str, str]], dest: str, summarizer: Callabl title = article["title"] text = article["content"] - # if len(news) < 15: - # # If there are less than 15 articles, summarize each article in the usual way - # summary = summarizer(text, title) - # else: - # summary = brief_summary(text, title) + if len(news) < 24: + # If there are less than 24 articles, summarize each article in the usual way + summary = summarizer(text, title) + else: + if counter % 2 == 0: + summary = summarizer(text, title) + else: + summary = brief_summary(text, title) - summary = summarizer(text, title) + # summary = summarizer(text, title) if summary.strip().startswith("Summary: "): summary = summary.replace("Summary: ", "")