Spaces:
Runtime error
Runtime error
File size: 1,083 Bytes
2833618 33f1577 9df16cf 2833618 9df16cf bf12410 ed306d0 33f1577 2c95677 78128cf bf12410 33f1577 78128cf 9df16cf 2c95677 13fcde7 78128cf 33f1577 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import streamlit as st
from transformers import pipeline
@st.cache(allow_output_mutation=True)
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) |