lqqqqqqqqq commited on
Commit
c1ddc17
1 Parent(s): 51caef2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -3,22 +3,25 @@ from transformers import pipeline
3
 
4
  # Load the text classification model pipeline
5
  classifier = pipeline("text-classification", model="lqqqqqqqqq/FinetunedModelGr9", return_all_scores=True)
 
6
  # Streamlit application title
7
  st.title("Text Classification")
8
  st.write("Classification for 3 labels: negative, neutual, positive")
 
9
  # Text input for user to enter the text to classify
10
  text = st.text_area("Enter the text to classify", "")
 
11
  # Perform text classification when the user clicks the "Classify" button
12
  if st.button("Classify"):
13
- # Perform text classification on the input text
14
- results = classifier(text)[0]
15
- # Display the classification result
16
- max_score = float('-inf')
17
- max_label = ''
18
- for result in results:
19
- if result['score'] > max_score:
20
- max_score = result['score']
21
- max_label = result['label']
22
- st.write("Text:", text)
23
- st.write("Label:", max_label)
24
- st.write("Score:", max_score)
 
3
 
4
  # Load the text classification model pipeline
5
  classifier = pipeline("text-classification", model="lqqqqqqqqq/FinetunedModelGr9", return_all_scores=True)
6
+
7
  # Streamlit application title
8
  st.title("Text Classification")
9
  st.write("Classification for 3 labels: negative, neutual, positive")
10
+
11
  # Text input for user to enter the text to classify
12
  text = st.text_area("Enter the text to classify", "")
13
+
14
  # Perform text classification when the user clicks the "Classify" button
15
  if st.button("Classify"):
16
+ # Perform text classification on the input text
17
+ results = classifier(text)[0]
18
+ # Display the classification result
19
+ max_score = float('-inf')
20
+ max_label = ''
21
+ for result in results:
22
+ if result['score'] > max_score:
23
+ max_score = result['score']
24
+ max_label = result['label']
25
+ st.write("Text:", text)
26
+ st.write("Label:", max_label)
27
+ st.write("Score:", max_score)