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