File size: 907 Bytes
8056289
2f910ac
8056289
0f264ab
 
 
 
d12f627
0f264ab
 
 
f0e521d
0f264ab
 
f0e521d
0f264ab
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)