Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
# Load Hugging Face summarization model | |
def load_summarization_model(): | |
summarizer = pipeline("summarization", model="Ramji/bart-cn-large-medical-summary") # You can replace with another model | |
return summarizer | |
summarizer = load_summarization_model() | |
# Streamlit UI | |
st.title("Text Summarization with Hugging Face") | |
st.write("This app uses a Finetuned Bart model to summarize long text inputs.") | |
# Input text area for the user | |
user_input = st.text_area("Enter text to summarize:", height=300) | |
# Summarize when the button is clicked | |
if st.button("Summarize"): | |
if user_input: | |
# Get the summary | |
summary = summarizer(user_input) | |
print("output", summary) | |
# Display the result | |
st.subheader("Summary") | |
st.write(summary[0]['summary_text']) | |
else: | |
st.write("Please enter some text to summarize.") | |