Spaces:
Runtime error
Runtime error
cychristophercyc
commited on
Commit
•
f7762fc
1
Parent(s):
9201aed
Update app.py
Browse files
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 |
-
|
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 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
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)
|
|