Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the custom model and tokenizer
|
| 5 |
+
pipe = pipeline("sentiment-analysis", model="rickxzo/review-sentiment-analysis", tokenizer="rickxzo/review-sentiment-analysis")
|
| 6 |
+
|
| 7 |
+
# Streamlit UI
|
| 8 |
+
st.title("Sentiment Analysis with Transformer Model")
|
| 9 |
+
text = st.text_area("Enter some text:")
|
| 10 |
+
|
| 11 |
+
# Perform sentiment analysis when text is provided
|
| 12 |
+
if text:
|
| 13 |
+
out = pipe(text)
|
| 14 |
+
st.json(out)
|