File size: 707 Bytes
02f0188
7562d6c
 
02f0188
 
 
7562d6c
02f0188
7562d6c
02f0188
 
7562d6c
02f0188
 
7562d6c
02f0188
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
from transformers import pipeline

# Replace with your actual model URL
model_url = "your_hf_username/your_model_name"

# Load the model and tokenizer from Hugging Face
summarizer = pipeline("summarization", model=model_url)

# Streamlit application
st.title("Text Summarization with BART")

# Text input from the user
user_input = st.text_area("Enter the text to summarize:")

# If user input is provided, summarize the text
if user_input:
    with st.spinner("Summarizing..."):
        summary = summarizer(user_input, max_length=130, min_length=30, do_sample=False)
        summarized_text = summary[0]['summary_text']
        st.text_area("Summary:", summarized_text, height=200)