proKBD commited on
Commit
0abb18c
·
verified ·
1 Parent(s): a2dc7d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -43,16 +43,24 @@ def process_company(company_name):
43
  translator = get_translator()
44
  if translator:
45
  try:
46
- # Translate final analysis to Hindi
47
- translated_analysis = translator.translate(
48
- data["final_sentiment_analysis"],
49
- dest='hi'
50
- ).text
 
 
 
 
 
 
 
 
51
 
52
  # Generate Hindi audio
53
  tts_converter = TextToSpeechConverter()
54
  audio_path = tts_converter.generate_audio(
55
- translated_analysis,
56
  f'{company_name}_summary'
57
  )
58
  data['audio_path'] = audio_path
 
43
  translator = get_translator()
44
  if translator:
45
  try:
46
+ # Create a more detailed Hindi explanation
47
+ sentiment_explanation = f"""
48
+ {company_name} के समाचारों का विश्लेषण:
49
+
50
+ समग्र भावना: {data['final_sentiment_analysis']}
51
+
52
+ भावनात्मक विश्लेषण:
53
+ - सकारात्मक भावना: {data.get('comparative_sentiment_score', {}).get('sentiment_indices', {}).get('positivity_index', 0):.2f}
54
+ - नकारात्मक भावना: {data.get('comparative_sentiment_score', {}).get('sentiment_indices', {}).get('negativity_index', 0):.2f}
55
+ - भावनात्मक तीव्रता: {data.get('comparative_sentiment_score', {}).get('sentiment_indices', {}).get('emotional_intensity', 0):.2f}
56
+
57
+ विश्वसनीयता स्कोर: {data.get('comparative_sentiment_score', {}).get('sentiment_indices', {}).get('confidence_score', 0):.2f}
58
+ """
59
 
60
  # Generate Hindi audio
61
  tts_converter = TextToSpeechConverter()
62
  audio_path = tts_converter.generate_audio(
63
+ sentiment_explanation,
64
  f'{company_name}_summary'
65
  )
66
  data['audio_path'] = audio_path