Commit
·
89fa82a
1
Parent(s):
cf52177
Update app.py
Browse files
app.py
CHANGED
@@ -6,28 +6,48 @@ model_path = "abhisheky127/FeedbackSummarizerEnterpret"
|
|
6 |
|
7 |
summarizer = pipeline("summarization", model=model_path)
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
st.title("Feedback Summarizer: Enterpret")
|
10 |
st.markdown(
|
11 |
"""
|
12 |
#### Summarize reviews/feedbacks with fine-tuned T5-small language Model
|
13 |
> *powered by Hugging Face T5, Streamlit*
|
14 |
-
|
15 |
"""
|
16 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
text = "<product>zoom</product><type>Appstore/Playstore</type><text>user: this is very successful meeting business</text>"
|
19 |
-
pred = summarizer(text)
|
20 |
-
st.write(pred)
|
21 |
|
22 |
-
# file_name = st.file_uploader("Upload a hot dog candidate image")
|
23 |
|
24 |
-
# if file_name is not None:
|
25 |
-
# col1, col2 = st.columns(2)
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
# predictions = pipeline(image)
|
30 |
|
31 |
-
# col2.header("Probabilities")
|
32 |
-
# for p in predictions:
|
33 |
-
# col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
|
|
6 |
|
7 |
summarizer = pipeline("summarization", model=model_path)
|
8 |
|
9 |
+
def postprocess(prediction, input):
|
10 |
+
if len(input.split(" "))<5:
|
11 |
+
return("None")
|
12 |
+
else:
|
13 |
+
return(prediction.split('.')[0]+".")
|
14 |
+
|
15 |
st.title("Feedback Summarizer: Enterpret")
|
16 |
st.markdown(
|
17 |
"""
|
18 |
#### Summarize reviews/feedbacks with fine-tuned T5-small language Model
|
19 |
> *powered by Hugging Face T5, Streamlit*
|
20 |
+
|
21 |
"""
|
22 |
)
|
23 |
+
st.image("Screenshot 2023-06-25 at 11.49.26 PM.png")
|
24 |
+
st.markdown("----")
|
25 |
+
|
26 |
+
product = st.text_input('Product', '')
|
27 |
+
|
28 |
+
type = st.text_input('Record Type', '')
|
29 |
+
|
30 |
+
text = st.text_area('Text to Summarize', '''''')
|
31 |
+
|
32 |
+
if st.button('Summarize'):
|
33 |
+
if len(product) and len(type) and len(text):
|
34 |
+
with st.spinner(
|
35 |
+
"Summarizing your feedback : `{}` ".format(query)
|
36 |
+
):
|
37 |
+
text = "<product>{}</product><type>{}</type><text>{}</text>".format(product, type, text)
|
38 |
+
|
39 |
+
res = summarizer(text)[0]["summary_text"]
|
40 |
+
res = post_process(res, text)
|
41 |
+
st.info(res, icon="🤖")
|
42 |
+
else:
|
43 |
+
st.write('I think something is missing, please check your inputs!')
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
|
|
|
|
|
|
|
48 |
|
|
|
49 |
|
|
|
|
|
50 |
|
51 |
+
st.markdown("----")
|
52 |
+
st.image("Screenshot 2022-11-20 at 5.40.54 AM.png")
|
|
|
53 |
|
|
|
|
|
|