Spaces:
Running
Running
JustHuggingFaces
commited on
Commit
•
570a6f9
1
Parent(s):
44ee5e5
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
5 |
# Streamlit application title
|
6 |
-
st.title("
|
7 |
-
st.write("Classification for
|
8 |
# Text input for user to enter the text to classify
|
9 |
-
text = st.text_area("
|
10 |
# Perform text classification when the user clicks the "Classify" button
|
11 |
if st.button("Classify"):
|
12 |
-
# Perform text classification on the input text
|
13 |
-
results = classifier(text)[0]
|
14 |
-
# Display the classification result
|
15 |
-
|
16 |
-
|
17 |
-
for result in results:
|
18 |
-
if result['
|
19 |
-
|
20 |
-
|
21 |
-
st.write("Text:", text)
|
22 |
-
st.write("Label:", max_label)
|
23 |
-
st.write("Score:", max_score
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
+
import soundfile as sf
|
4 |
+
$ pip install txtai[pipeline]
|
5 |
+
from txtai.pipeline import TextToSpeech
|
6 |
+
|
7 |
+
# Load the text classification model pipeline, filter out the spam and leave the ham
|
8 |
+
classifier = pipeline("text-classification", model='JustHuggingFaces/OptimalSpamDetect', return_all_scores=True)
|
9 |
+
to_speech = TextToSpeech("NeuML/ljspeech-jets-onnx")
|
10 |
# Streamlit application title
|
11 |
+
st.title("Reading Ham")
|
12 |
+
st.write("Classification for Spam Email: spam or ham?")
|
13 |
# Text input for user to enter the text to classify
|
14 |
+
text = st.text_area("Paste the email to classify", "")
|
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 |
+
results = classifier(text)[0]
|
19 |
+
# Display the classification result
|
20 |
+
spam = "LABEL_1"
|
21 |
+
ham = "LABEL_0"
|
22 |
+
for result in results:
|
23 |
+
if result['label'] == spam:
|
24 |
+
#st.write("Text:", text)
|
25 |
+
st.write("Label: Spam")
|
|
|
|
|
|