Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,12 @@ def url_to_audio_summary(url):
|
|
54 |
if article_text.startswith("Error"):
|
55 |
return article_text, None
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
audio_path = generate_human_like_audio(summary)
|
60 |
if not audio_path:
|
|
|
54 |
if article_text.startswith("Error"):
|
55 |
return article_text, None
|
56 |
|
57 |
+
# Truncate for model's 512-token limit
|
58 |
+
if len(article_text) > 1500:
|
59 |
+
article_text = article_text[:1500] + "..."
|
60 |
+
|
61 |
+
summary = summary_chain.invoke({"text": article_text})
|
62 |
+
summary = summary["text"] if isinstance(summary, dict) and "text" in summary else summary
|
63 |
|
64 |
audio_path = generate_human_like_audio(summary)
|
65 |
if not audio_path:
|