Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
-
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
-
predicted_class_id = logits.argmax().item()
|
| 13 |
-
model.config.id2label[predicted_class_id]
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
|
| 4 |
|
| 5 |
+
st.title("Sentiment Analysis App")
|
| 6 |
+
userinput=st.text_area("Enter text for analysis")
|
| 7 |
|
| 8 |
+
if userinput:
|
| 9 |
+
result=sentiment_task(userinput)
|
| 10 |
|
| 11 |
+
st.write("Sentiment analysis result:")
|
| 12 |
+
st.write(f"label]:{ result[0]['label']}]")
|
| 13 |
+
st.write(f"confidence]:{ result[0]['score']:,4f}]")
|
| 14 |
|
|
|
|
|
|