RohitCSharp commited on
Commit
e66aff4
·
verified ·
1 Parent(s): 83f07d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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
- summary = summary_chain.run(text=article_text)
 
 
 
 
 
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: