Ryan Kim commited on
Commit
adb7c0e
1 Parent(s): 1532934

main.py now is fit for huggingspaces and streamlit

Browse files
Files changed (1) hide show
  1. src/main.py +27 -2
src/main.py CHANGED
@@ -1,10 +1,35 @@
 
1
  from transformers import pipeline
2
 
3
- classifier = pipeline(task="sentiment-analysis")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  user_input = input("Please enter a text to perform sentiment analysis upon:\n")
6
 
7
  classification = classifier(user_input)
8
 
9
  print("Sentimeny Analysis:")
10
- print(classification)
 
 
1
+ import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Title
5
+ st.title("CSGY-6613 Sentiment Analysis - by Ryan Kim (rk2546)")
6
+ # Subtitle
7
+ st.markdown("## Ryan Kim (rk2546)")
8
+ st.markdown("")
9
+
10
+ if "model" not in st.session_state:
11
+ st.session_state.model = "Test"
12
+
13
+ text_input = st.text_input(
14
+ "Enter some text 👇",
15
+ placeholder="I like burgers...",
16
+ )
17
+
18
+ if text_input:
19
+ st.write("You entered: ", text_input)
20
+
21
+ """
22
+ @st.cache
23
+ def load_model():
24
+ classifier = pipeline(task="sentiment-analysis")
25
+ return classifier
26
+
27
+ classifier = load_model()
28
 
29
  user_input = input("Please enter a text to perform sentiment analysis upon:\n")
30
 
31
  classification = classifier(user_input)
32
 
33
  print("Sentimeny Analysis:")
34
+ print(classification)
35
+ """