Spaces:
Sleeping
Sleeping
| # Import necessary libraries | |
| import streamlit as st | |
| from utils import model_predict | |
| # Set page configuration | |
| st.set_page_config( | |
| page_title="Spam Email Detection App", | |
| page_icon="📧", | |
| layout="centered" | |
| ) | |
| # Create the Streamlit app | |
| st.title("Spam Email Detection App") | |
| st.write("Enter an email to get a prediction") | |
| # Create form for email input | |
| with st.form(key="email_form"): | |
| email = st.text_input("Email") | |
| submit_button = st.form_submit_button(label="Predict") | |
| # When form is submitted | |
| if submit_button: | |
| if not email: | |
| st.error("Email is required.") | |
| else: | |
| # Show a spinner while predicting | |
| with st.spinner("Predicting..."): | |
| prediction = model_predict(email) | |
| # Display results | |
| st.success(f"Prediction complete!") | |
| st.write(f"Email Body: {email}") | |
| st.write(f"Prediction: {prediction}") | |
| # Footer | |
| st.markdown("---") | |
| st.markdown("Created with Streamlit") |