Spaces:
Running
Running
import streamlit as st | |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline | |
# Load model and tokenizer | |
tokenizer = AutoTokenizer.from_pretrained("Chillyblast/Bart_Summarization") | |
model = AutoModelForSeq2SeqLM.from_pretrained("Chillyblast/Bart_Summarization") | |
# Create a pipeline for text summarization | |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer) | |
# Streamlit app | |
st.title("Text Summarization App") | |
# Create a text input box for user input | |
dialogue = st.text_area("Enter the input:") | |
if dialogue: | |
# Perform inference | |
summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False) | |
# Display the summary | |
st.write("Summary:", summary[0]['summary_text']) |