Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
|
|
|
|
3 |
|
4 |
-
#
|
5 |
-
|
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
|