Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ def predict_sentiment(text, model):
|
|
14 |
out = pipe(text, return_all_scores=True)
|
15 |
return {pred["label"]: pred["score"] for pred in out}
|
16 |
elif model == "vader":
|
|
|
17 |
sia = SentimentIntensityAnalyzer()
|
18 |
return sia.polarity_scores(text)
|
19 |
|
@@ -34,7 +35,7 @@ with demo:
|
|
34 |
with gr.TabItem("Multiple Inputs"):
|
35 |
gr.Markdown("A more complex interface for sentiment analysis with multiple inputs, including a dropdown, and some examples")
|
36 |
demo = gr.Interface(
|
37 |
-
|
38 |
[
|
39 |
gr.TextBox(placeholder="Your text input"),
|
40 |
gr.Dropdown(
|
|
|
14 |
out = pipe(text, return_all_scores=True)
|
15 |
return {pred["label"]: pred["score"] for pred in out}
|
16 |
elif model == "vader":
|
17 |
+
nltk.download('vader_lexicon')
|
18 |
sia = SentimentIntensityAnalyzer()
|
19 |
return sia.polarity_scores(text)
|
20 |
|
|
|
35 |
with gr.TabItem("Multiple Inputs"):
|
36 |
gr.Markdown("A more complex interface for sentiment analysis with multiple inputs, including a dropdown, and some examples")
|
37 |
demo = gr.Interface(
|
38 |
+
predict_sentiment,
|
39 |
[
|
40 |
gr.TextBox(placeholder="Your text input"),
|
41 |
gr.Dropdown(
|