Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
import soundfile as sf | |
pip install txtai[pipeline] | |
from txtai.pipeline import TextToSpeech | |
# Load the text classification model pipeline, filter out the spam and leave the ham | |
classifier = pipeline("text-classification", model='JustHuggingFaces/OptimalSpamDetect', return_all_scores=True) | |
to_speech = TextToSpeech("NeuML/ljspeech-jets-onnx") | |
# Streamlit application title | |
st.title("Reading Ham") | |
st.write("Classification for Spam Email: spam or ham?") | |
# Text input for user to enter the text to classify | |
text = st.text_area("Paste the email to classify", "") | |
# Perform text classification when the user clicks the "Classify" button | |
if st.button("Classify"): | |
# Perform text classification on the input text | |
results = classifier(text)[0] | |
# Display the classification result | |
spam = "LABEL_1" | |
ham = "LABEL_0" | |
for result in results: | |
if result['label'] == spam: | |
#st.write("Text:", text) | |
st.write("Label: Spam") |