Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
def load_summarizer(): | |
summarizer = pipeline("summarization", model="google/bigbird-pegasus-large-bigpatent") | |
return summarizer | |
summarize = load_summarizer() | |
st.title("Patent Text Summarizer") | |
sentence = st.text_area('Please paste your Patent Text :', height=300) | |
button = st.button("Summarize") | |
#max = st.sidebar.slider('Select max', 50, 500, step=10, value=500) | |
#min = st.sidebar.slider('Select min', 10, 100, step=10, value=100) | |
#do_sample = st.sidebar.checkbox("Do sample", value=False) | |
with st.spinner("Generating Patent Summary.."): | |
if button and sentence: | |
#chunks = generate_chunks(sentence) | |
res = summarize(sentence, | |
max_length=500, | |
min_length=100, | |
truncation=True, | |
#do_sample=do_sample | |
) | |
text = ' '.join([summ['summary_text'] for summ in res]) | |
# st.write(result[0]['summary_text']) | |
st.write(text) |