File size: 1,399 Bytes
5028fb3
 
 
 
 
 
 
 
89fa82a
 
 
 
 
 
bd0a70f
5028fb3
 
 
 
89fa82a
5028fb3
 
89fa82a
 
 
 
 
 
 
 
 
 
 
 
a6d6e02
89fa82a
e36f4bc
89fa82a
e36f4bc
53d25df
89fa82a
 
 
 
 
 
5028fb3
 
 
 
89fa82a
 
5028fb3
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 = "<product>{}</product><type>{}</type><text>{}</text>".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")