ivyblossom commited on
Commit
f7d8474
1 Parent(s): 1cf7655

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -2,11 +2,6 @@ import streamlit as st
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
 
@@ -35,7 +30,10 @@ def main():
35
  # Add more models here if desired
36
  }
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)
 
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
 
 
30
  # Add more models here if desired
31
  }
32
 
33
+ # Load the pretrained model and tokenizer
34
+ model_name = st.selectbox("Select a pretrained model", list(model_options.keys()))
35
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
36
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
37
 
38
  if st.button("Analyze"):
39
  sentiment_label, probabilities = perform_sentiment_analysis(text)