Spaces:
Sleeping
Sleeping
Update pages/3_Deployment.py
Browse files- pages/3_Deployment.py +0 -40
pages/3_Deployment.py
CHANGED
|
@@ -17,46 +17,6 @@ st.markdown("""
|
|
| 17 |
- π **Neutral**: tech reviews, travel vlogs, gaming walkthroughs
|
| 18 |
""")
|
| 19 |
|
| 20 |
-
# User input
|
| 21 |
-
user_input = st.text_area("##### **Enter a YouTube comment to analyze:**",
|
| 22 |
-
placeholder="E.g., That reunion video was so emotional!")
|
| 23 |
-
|
| 24 |
-
# Predict button
|
| 25 |
-
if st.button("Predict Sentiment"):
|
| 26 |
-
if user_input.strip():
|
| 27 |
-
prediction = pipeline.predict([user_input])[0]
|
| 28 |
-
st.markdown(f"## β
Prediction: `{prediction.capitalize()}`")
|
| 29 |
-
|
| 30 |
-
if prediction == "positive":
|
| 31 |
-
st.success("π Positive Sentiment")
|
| 32 |
-
elif prediction == "negative":
|
| 33 |
-
st.error("π Negative Sentiment")
|
| 34 |
-
else:
|
| 35 |
-
st.info("π Neutral Sentiment")
|
| 36 |
-
else:
|
| 37 |
-
st.warning("β οΈ Please enter a comment to analyze.")
|
| 38 |
-
|
| 39 |
-
# Navigation
|
| 40 |
-
if st.button("Go to Model Page"):
|
| 41 |
-
st.switch_page("pages/2_Model_Training.py")import streamlit as st
|
| 42 |
-
import pickle
|
| 43 |
-
|
| 44 |
-
st.set_page_config(page_title="π― YouTube Comment Sentiment Predictor")
|
| 45 |
-
|
| 46 |
-
st.title("π― Live Sentiment Classifier")
|
| 47 |
-
|
| 48 |
-
# Load the complete pipeline (TF-IDF + Model)
|
| 49 |
-
with open("text_classification.pkl", "rb") as f:
|
| 50 |
-
pipeline = pickle.load(f)
|
| 51 |
-
|
| 52 |
-
# Helpful context for users
|
| 53 |
-
st.markdown("#### π *This model works best for YouTube comments related to the following topics:*")
|
| 54 |
-
st.markdown("""
|
| 55 |
-
- π **Positive**: heartwarming reunion, kindness stories, feel-good moments
|
| 56 |
-
- π **Negative**: bad customer experience, airline disaster, controversial incident
|
| 57 |
-
- π **Neutral**: tech reviews, travel vlogs, gaming walkthroughs
|
| 58 |
-
""")
|
| 59 |
-
|
| 60 |
# User input
|
| 61 |
user_input = st.text_area("##### **Enter a YouTube comment to analyze:**",
|
| 62 |
placeholder="E.g., That reunion video was so emotional!")
|
|
|
|
| 17 |
- π **Neutral**: tech reviews, travel vlogs, gaming walkthroughs
|
| 18 |
""")
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# User input
|
| 21 |
user_input = st.text_area("##### **Enter a YouTube comment to analyze:**",
|
| 22 |
placeholder="E.g., That reunion video was so emotional!")
|