Divyansh Kushwaha commited on
Commit
d4cfa30
·
1 Parent(s): aea053c
Files changed (1) hide show
  1. api.py +1 -2
api.py CHANGED
@@ -31,7 +31,6 @@ def generate_summary(company_name):
31
  news_articles = extract_topics_with_hf(news_articles)
32
  final_summary = compare_articles(news_articles, sentiment_counts)
33
  hindi_text = ""
34
- hindi_summary=None
35
  if ELEVEN_LABS_API_KEY and VOICE_ID:
36
  hindi_prompt = f"Just Translate this text into Hindi: {final_summary['Final Sentiment Analysis']}"
37
  hindi_response = llm.invoke([HumanMessage(content=hindi_prompt)]).content
@@ -59,7 +58,7 @@ def generate_summary(company_name):
59
  audio_bytes = None
60
  if not os.path.exists(AUDIO_FILE_PATH):
61
  print(f"Audio file could not be found at {AUDIO_FILE_PATH}.")
62
- final_summary["Hindi Summary"] = audio_bytes
63
 
64
  with open(JSON_FILE_PATH,"w") as f:
65
  json.dump(final_summary,f,indent=4)
 
31
  news_articles = extract_topics_with_hf(news_articles)
32
  final_summary = compare_articles(news_articles, sentiment_counts)
33
  hindi_text = ""
 
34
  if ELEVEN_LABS_API_KEY and VOICE_ID:
35
  hindi_prompt = f"Just Translate this text into Hindi: {final_summary['Final Sentiment Analysis']}"
36
  hindi_response = llm.invoke([HumanMessage(content=hindi_prompt)]).content
 
58
  audio_bytes = None
59
  if not os.path.exists(AUDIO_FILE_PATH):
60
  print(f"Audio file could not be found at {AUDIO_FILE_PATH}.")
61
+ final_summary["Hindi Summary"] = hindi_text
62
 
63
  with open(JSON_FILE_PATH,"w") as f:
64
  json.dump(final_summary,f,indent=4)