Lauraayu's picture
Update app.py
0f264ab verified
raw
history blame
907 Bytes
import streamlit as st
from transformers import pipeline
def main():
# Define pipelines
summarizer_ntg = pipeline(model="mrm8488/t5-base-finetuned-summarize-news")
model = pipeline(model="Lauraayu/News_Classi_Model")
# Streamlit application title
st.title("News Article Classifier")
st.write("Enter a news article text to get its category:")
# Text input for user to enter the news article text
text = st.text_area("Enter the news article text here:")
# Perform summarization and classification when the user clicks the "Classify" button
if st.button("Classify"):
# Perform text summarization
summary = summarizer_ntg(text)[0]
# Perform classification
output = model(summary)
category = output[0]["label"]
# Display the summary and classification result
st.write("Category:", category)