Vishaltiwari2019 commited on
Commit
9a57be1
·
verified ·
1 Parent(s): 8a61ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,8 +1,11 @@
1
  import gradio as gr
2
- from nltk.sentiment import SentimentIntensityAnalyzer
 
 
 
3
 
4
- # Load sentiment analysis model
5
- sia = SentimentIntensityAnalyzer()
6
 
7
  # Text to Speech
8
  title = "Text to Speech with Sentiment Analysis"
@@ -13,6 +16,7 @@ tts_examples = [
13
 
14
  def get_sentiment(text):
15
  # Get sentiment score
 
16
  sentiment_score = sia.polarity_scores(text)["compound"]
17
 
18
  # Adjust speech synthesis parameters based on sentiment
 
1
  import gradio as gr
2
+ import nltk
3
+
4
+ # Download the VADER lexicon
5
+ nltk.download('vader_lexicon')
6
 
7
+ # Rest of your code
8
+ from nltk.sentiment import SentimentIntensityAnalyzer
9
 
10
  # Text to Speech
11
  title = "Text to Speech with Sentiment Analysis"
 
16
 
17
  def get_sentiment(text):
18
  # Get sentiment score
19
+ sia = SentimentIntensityAnalyzer()
20
  sentiment_score = sia.polarity_scores(text)["compound"]
21
 
22
  # Adjust speech synthesis parameters based on sentiment