Spaces:
Runtime error
Runtime error
import streamlit as st | |
from paraphraser import get_key_sentences, ParaphraseModel | |
paraphraser = ParaphraseModel() | |
# Add a model selector to the sidebar: | |
model = st.sidebar.selectbox( | |
'Select Model', | |
('T5-base', 'DistilT5-base', 'T5-small') | |
) | |
top_k = st.sidebar.slider('Top_K', 100, 300, 168) | |
top_p = st.sidebar.slider('Top_P', 0.0, 1.0, 0.95) | |
st.header("Bullet-point Summarization") | |
st.write(f'Model in use: {model}') | |
txt = st.text_area('Text to analyze', ) | |
if len(txt) >= 1: | |
key_sentences = get_key_sentences(txt) | |
sentences = [] | |
for i in sorted(key_sentences): | |
sentences.append(key_sentences[i]) | |
paraphrased_sentences = paraphraser(sentences, top_k=top_k, top_p=top_p, num_sequences=1) | |
else: | |
sentences = [] | |
paraphrased_sentences = [] | |
st.header('Extracted Key Sentences') | |
st.write(sentences) | |
st.header('Paraphrase results') | |
st.write(paraphrased_sentences) | |