Spaces:
Sleeping
Sleeping
| 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) | |