import streamlit as st
from transformers import pipeline
from PIL import Image
model_path = "abhisheky127/FeedbackSummarizerEnterpret"
summarizer = pipeline("summarization", model=model_path)
def postprocess(prediction, input):
if len(input.split(" "))<5:
return("None")
else:
return(prediction.split('.')[0]+".")
st.title("Feedback Summarizer: Enterpret")
st.markdown(
"""
#### Summarize reviews/feedbacks with fine-tuned T5-small language Model
> *powered by Hugging Face T5, Streamlit*
"""
)
st.image("Screenshot 2023-06-25 at 11.49.26 PM.png")
st.markdown("----")
product = st.text_input('Product', '')
type = st.text_input('Record Type', '')
text = st.text_area('Text to Summarize', '''''')
if st.button('Summarize'):
if len(product) and len(type) and len(text):
with st.spinner(
"Summarizing your feedback : `{}` ".format(text)
):
text1 = "{}{}{}".format(product, type, text)
res = summarizer(text1)[0]["summary_text"]
res = postprocess(res, text)
st.info(res, icon="🤖")
else:
st.write('I think something is missing, please check your inputs!')
st.markdown("----")
st.image("Screenshot 2022-11-20 at 5.40.54 AM.png")