File size: 818 Bytes
8056289
e1fb94e
 
8056289
e1fb94e
75f81b9
203fe06
e1fb94e
 
 
 
 
 
 
 
 
 
75f81b9
 
203fe06
75f81b9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
import torch

# Define the summarization pipeline
summarizer_ntg = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-summarize-news")


# Streamlit application title
st.title("News Article Summarizer and Classifier")
st.write("Enter a news article text to get its summary and 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]['summary_text']
        
    # Display the summary and classification result
    st.write("Summary:", summary)