saidsef's picture
fix: only download of there is data
ac48c85 verified
raw
history blame
539 Bytes
import streamlit as st
from transformers import pipeline
st.set_page_config(page_title="Text Summarisation", page_icon="🤖", layout="wide", initial_sidebar_state="expanded",)
st.title("Text Summarisation")
pipe = pipeline(task="summarization", model="facebook/bart-large-cnn")
text = st.text_area("Summarise the following")
if text:
out = pipe(text, do_sample=False)
st.write(out)
stwrite(f"{type(out)}")
if len(out) > 100:
st.download_button("summary download", out, file_name="summersation.txt", mime="text/plain")