Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ def main():
|
|
11 |
text_input = st.text_input("Enter text for sentiment analysis")
|
12 |
|
13 |
if st.button("Analyze"):
|
14 |
-
if text_input:
|
15 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
16 |
encoded_input = tokenizer(text_input, return_tensors='pt', padding=True, truncation=True)
|
17 |
sentiment_classifier = pipeline("sentiment-analysis", model=model_name)
|
@@ -37,7 +37,7 @@ def main():
|
|
37 |
st.plotly_chart(fig)
|
38 |
|
39 |
else:
|
40 |
-
st.warning("Please enter some text for sentiment analysis")
|
41 |
|
42 |
if __name__ == "__main__":
|
43 |
main()
|
|
|
11 |
text_input = st.text_input("Enter text for sentiment analysis")
|
12 |
|
13 |
if st.button("Analyze"):
|
14 |
+
if text_input and isinstance(text_input, str):
|
15 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
16 |
encoded_input = tokenizer(text_input, return_tensors='pt', padding=True, truncation=True)
|
17 |
sentiment_classifier = pipeline("sentiment-analysis", model=model_name)
|
|
|
37 |
st.plotly_chart(fig)
|
38 |
|
39 |
else:
|
40 |
+
st.warning("Please enter some valid text for sentiment analysis")
|
41 |
|
42 |
if __name__ == "__main__":
|
43 |
main()
|