Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,18 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
# Load the sentiment analysis pipeline using the selected model
|
| 5 |
-
nlp = pipeline("sentiment-analysis", model="distilbert-base-uncased")
|
| 6 |
|
| 7 |
-
# Streamlit app
|
| 8 |
st.title("Sentiment Analysis App")
|
| 9 |
user_input = st.text_input("Enter a sentence for sentiment analysis:")
|
| 10 |
if user_input:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
+
# Use a pipeline as a high-level helper
|
| 4 |
+
from transformers import pipeline
|
| 5 |
+
|
| 6 |
+
pipe = pipeline("text-classification", model="OatNapat/finetuned_yelp")
|
| 7 |
+
# Load model directly
|
| 8 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 9 |
+
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained("OatNapat/finetuned_yelp")
|
| 11 |
+
model = AutoModelForSequenceClassification.from_pretrained("OatNapat/finetuned_yelp")
|
| 12 |
+
|
| 13 |
+
nlp = pipeline("sentiment-analysis", model=model)
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
|
|
|
| 16 |
st.title("Sentiment Analysis App")
|
| 17 |
user_input = st.text_input("Enter a sentence for sentiment analysis:")
|
| 18 |
if user_input:
|