Spaces:
Sleeping
Sleeping
App updated
Browse files
app.py
CHANGED
@@ -1,19 +1,17 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
import torch
|
4 |
|
5 |
-
# Load the model and tokenizer
|
6 |
-
model = transformers.AutoModelForSequenceClassification.from_pretrained("MrDdz/mytuned_test_trainer-base-cased1")
|
7 |
-
tokenizer = transformers.AutoTokenizer.from_pretrained("xlnet-base-cased")
|
8 |
|
9 |
# Define the function for sentiment analysis
|
10 |
@st.cache_resource
|
11 |
def predict_sentiment(text):
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
# Predict the sentiment.
|
16 |
-
prediction =
|
17 |
sentiment = prediction[0]["label"]
|
18 |
score = prediction[0]["score"]
|
19 |
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
5 |
|
6 |
# Define the function for sentiment analysis
|
7 |
@st.cache_resource
|
8 |
def predict_sentiment(text):
|
9 |
+
# Load the model and tokenizer
|
10 |
+
model = transformers.AutoModelForSequenceClassification.from_pretrained("MrDdz/mytuned_test_trainer-base-cased1")
|
11 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("xlnet-base-cased")
|
12 |
|
13 |
# Predict the sentiment.
|
14 |
+
prediction = (text)
|
15 |
sentiment = prediction[0]["label"]
|
16 |
score = prediction[0]["score"]
|
17 |
|