Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,9 @@ def get_classifier_model():
|
|
| 11 |
return pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 12 |
#return pipeline("zero-shot-classification",model="sentence-transformers/paraphrase-MiniLM-L6-v2")
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
#st.sidebar.image("Suncorp-Bank-logo.png",width=255)
|
| 16 |
|
|
@@ -20,6 +23,14 @@ st.title("Review Analyzer")
|
|
| 20 |
st.markdown("***")
|
| 21 |
|
| 22 |
text = st.text_area(label="Paste/Type the review here..")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
st.markdown("***")
|
| 24 |
|
| 25 |
col1, col2, col3 = st.columns((1,1,1))
|
|
@@ -54,6 +65,8 @@ def get_classification(candidate_labels):
|
|
| 54 |
)
|
| 55 |
return fig
|
| 56 |
|
|
|
|
|
|
|
| 57 |
if classify_button_clicked:
|
| 58 |
if text:
|
| 59 |
st.markdown("***")
|
|
|
|
| 11 |
return pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 12 |
#return pipeline("zero-shot-classification",model="sentence-transformers/paraphrase-MiniLM-L6-v2")
|
| 13 |
|
| 14 |
+
@st.cache(allow_output_mutation = True)
|
| 15 |
+
def get_summarization_model():
|
| 16 |
+
return pipeline("summarization", model="facebook/bart-large-mnli", tokenizer="facebook/bart-large-mnli")
|
| 17 |
|
| 18 |
#st.sidebar.image("Suncorp-Bank-logo.png",width=255)
|
| 19 |
|
|
|
|
| 23 |
st.markdown("***")
|
| 24 |
|
| 25 |
text = st.text_area(label="Paste/Type the review here..")
|
| 26 |
+
summarize_button_clicked = st.button("Summarize)
|
| 27 |
+
|
| 28 |
+
if summarize_button_clicked :
|
| 29 |
+
|
| 30 |
+
if text:
|
| 31 |
+
summarizer = get_summarization_model()
|
| 32 |
+
st.write(summarizer(text, min_length=5, max_length=40))
|
| 33 |
+
|
| 34 |
st.markdown("***")
|
| 35 |
|
| 36 |
col1, col2, col3 = st.columns((1,1,1))
|
|
|
|
| 65 |
)
|
| 66 |
return fig
|
| 67 |
|
| 68 |
+
|
| 69 |
+
|
| 70 |
if classify_button_clicked:
|
| 71 |
if text:
|
| 72 |
st.markdown("***")
|