Spaces:
Runtime error
Runtime error
File size: 728 Bytes
f073b42 7c43c1d f073b42 7c43c1d f073b42 7c43c1d edb69c3 f073b42 145e0c0 7c43c1d f073b42 6b4b2b8 7be320a e5a04ca 7be320a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import streamlit as st
from keybert import KeyBERT
from transformers.pipelines import pipeline
st.title('Title Summarization')
path='checkpoint-210000'
hf_model = pipeline("feature-extraction",model=path,tokenizer='bert-base-uncased' )
etsy_model = KeyBERT(model=hf_model)
text = st.text_area("Enter title here for the summarization:")
if st.button('Generate'):
out = etsy_model.extract_keywords(text, keyphrase_ngram_range=(1,3), stop_words='english', top_n=20)
if len(out[0][0]) < 20:
out = etsy_model.extract_keywords(text, keyphrase_ngram_range=(1,4), stop_words='english', top_n=20)
if len(out)==20:
show=[out[0],out[4],out[9],out[14],out[19]]
else:
show=out
st.json(show) |