cychristophercyc commited on
Commit
f7762fc
1 Parent(s): 9201aed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -8,22 +8,18 @@ classifier = pipeline("text-classification", model="cychristophercyc/Group12_Cus
8
  st.title("New Categorization")
9
  st.write("Classification for 6 categories: Business and Finance, Health and Wellness, Sports, [Arts, Culture, and Entertainment],Politics, Science and Technology")
10
 
11
- # Text input for user to enter the text to classify
12
- file = st.file_uploader('File uploader')
13
- content_list = [entry['content'] for entry in file]
14
-
15
  # Perform text classification when the user clicks the "Classify" button
16
  if st.button("Classify"):
17
  # Perform text classification on the input text
18
- for n in range(file.num_rows)
19
- results = classifier(file)[n]
20
- # Display the classification result
21
- max_score = float('-inf')
22
- max_label = ''
23
- for result in results:
24
- if result['score'] > max_score:
25
- max_score = result['score']
26
- max_label = result['label']
27
- st.write("Text:", text)
28
- st.write("Label:", max_label)
29
- st.write("Score:", max_score)
 
8
  st.title("New Categorization")
9
  st.write("Classification for 6 categories: Business and Finance, Health and Wellness, Sports, [Arts, Culture, and Entertainment],Politics, Science and Technology")
10
 
11
+ text = st.text_area("Enter the text to classify", "")
 
 
 
12
  # Perform text classification when the user clicks the "Classify" button
13
  if st.button("Classify"):
14
  # Perform text classification on the input text
15
+
16
+ # Display the classification result
17
+ max_score = float('-inf')
18
+ max_label = ''
19
+ for result in results:
20
+ if result['score'] > max_score:
21
+ max_score = result['score']
22
+ max_label = result['label']
23
+ st.write("Text:", text)
24
+ st.write("Label:", max_label)
25
+ st.write("Score:", max_score)