Spaces:
Runtime error
Runtime error
ivyblossom
commited on
Commit
•
1cf7655
1
Parent(s):
2d139eb
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,11 @@ import streamlit as st
|
|
2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
# Set up the device (GPU or CPU)
|
6 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
7 |
|
@@ -32,11 +37,6 @@ def main():
|
|
32 |
|
33 |
selected_model = st.selectbox("Select a pretrained model", list(model_options.keys()))
|
34 |
|
35 |
-
# Load the pretrained model and tokenizer
|
36 |
-
model_name = selected_model
|
37 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
38 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
39 |
-
|
40 |
if st.button("Analyze"):
|
41 |
sentiment_label, probabilities = perform_sentiment_analysis(text)
|
42 |
st.write(f"Sentiment: {sentiment_label}")
|
|
|
2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
3 |
import torch
|
4 |
|
5 |
+
# Load the pretrained model and tokenizer
|
6 |
+
model_name = selected_model
|
7 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
+
|
10 |
# Set up the device (GPU or CPU)
|
11 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
12 |
|
|
|
37 |
|
38 |
selected_model = st.selectbox("Select a pretrained model", list(model_options.keys()))
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
if st.button("Analyze"):
|
41 |
sentiment_label, probabilities = perform_sentiment_analysis(text)
|
42 |
st.write(f"Sentiment: {sentiment_label}")
|