EmmaL1 commited on
Commit
2781600
·
verified ·
1 Parent(s): c6614b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,7 +1,17 @@
1
  # import part
2
  import streamlit as st
3
  from transformers import pipeline
4
- import numpy as np # Import numpy
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Initialize sentiment analysis pipeline
7
  sentiment_pipeline = pipeline(model="EmmaL1/CustomModel_amazon")
@@ -12,7 +22,7 @@ qa_pipeline = pipeline("question-answering", model="distilbert/distilbert-base-c
12
  # function part
13
  # text classification
14
  def textclassification():
15
- st.title("Amazon Customer Sentiment AnalysisRatings and Reasons")
16
  st.write("Enter a sentence to analyze its rating and reason:")
17
 
18
  user_input = st.text_input("Input your text:")
 
1
  # import part
2
  import streamlit as st
3
  from transformers import pipeline
4
+ import numpy as np
5
+ import random
6
+ import torch
7
+
8
+ # Set random seed for reproducibility
9
+ seed = 42
10
+ random.seed(seed)
11
+ np.random.seed(seed)
12
+ torch.manual_seed(seed)
13
+ if torch.cuda.is_available():
14
+ torch.cuda.manual_seed_all(seed)
15
 
16
  # Initialize sentiment analysis pipeline
17
  sentiment_pipeline = pipeline(model="EmmaL1/CustomModel_amazon")
 
22
  # function part
23
  # text classification
24
  def textclassification():
25
+ st.title("Amazon Customer Sentiment Analysis: Ratings and Reasons")
26
  st.write("Enter a sentence to analyze its rating and reason:")
27
 
28
  user_input = st.text_input("Input your text:")