MrDdz commited on
Commit
f24ab5f
1 Parent(s): 0d231c6

App updated

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -1,19 +1,17 @@
1
  import streamlit as st
2
- import transformers
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
- # Load the pipeline.
13
- pipeline = transformers.pipeline("sentiment-analysis")
 
14
 
15
  # Predict the sentiment.
16
- prediction = pipeline(text)
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