MrDdz commited on
Commit
817f818
1 Parent(s): 9e99cfd
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -5,14 +5,9 @@ import numpy as np
5
 
6
 
7
  # Define the function for sentiment analysis
8
- @st.cache_resource()
9
 
10
- def get_model():
11
- # Load the model and tokenizer
12
- tokenizer = AutoTokenizer.from_pretrained("xlnet-base-cased")
13
- model = AutoModelForSequenceClassification.from_pretrained("MrDdz/mytuned_test_trainer-base-cased1")
14
- return tokenizer,model
15
- tokenizer, model = get_model()
16
 
17
  # # Setting the page configurations
18
  # st.set_page_config(
@@ -66,6 +61,15 @@ unsafe_allow_html=True
66
  # else:
67
  # st.warning(f"The sentiment is {sentiment} with a score of {score*100:.2f}%!")
68
 
 
 
 
 
 
 
 
 
 
69
  if text:
70
  text_sample = tokenizer([text], padding = True, Truncation = True, max_length = 512, return_tensors = 'pt' )
71
  output = model(** text_sample)
 
5
 
6
 
7
  # Define the function for sentiment analysis
 
8
 
9
+
10
+
 
 
 
 
11
 
12
  # # Setting the page configurations
13
  # st.set_page_config(
 
61
  # else:
62
  # st.warning(f"The sentiment is {sentiment} with a score of {score*100:.2f}%!")
63
 
64
+
65
+ @st.cache_resource()
66
+ def get_model():
67
+ # Load the model and tokenizer
68
+ tokenizer = AutoTokenizer.from_pretrained("xlnet-base-cased")
69
+ model = AutoModelForSequenceClassification.from_pretrained("MrDdz/mytuned_test_trainer-base-cased1")
70
+ return tokenizer,model
71
+ tokenizer, model = get_model()
72
+
73
  if text:
74
  text_sample = tokenizer([text], padding = True, Truncation = True, max_length = 512, return_tensors = 'pt' )
75
  output = model(** text_sample)