richardorama commited on
Commit
1b7a8ac
β€’
1 Parent(s): c1fb9cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -62,7 +62,7 @@ else:
62
  #st.warning('πŸ‘ˆ Please enter Sentiment!')
63
 
64
 
65
- ################ STATEMENT SUMMARIZATION1 - side bar - tokenizer #################
66
 
67
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
68
 
@@ -92,8 +92,8 @@ if STATEMENT:
92
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
93
 
94
  # Display the summary
95
- st.write("**Summary:**")
96
- st.write(summary)
97
  else:
98
  st.sidebar.button('Summarize Statement1', disabled=True)
99
  #st.warning('πŸ‘ˆ Please enter Statement!')
@@ -108,18 +108,18 @@ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
108
  st.sidebar.markdown("<h3 style='text-align: center; font-size: 16px; background-color: white; color: black;'>Text Summarization - BART Pipeline</h3>", unsafe_allow_html=True)
109
  DEFAULT_STATEMENT = ""
110
  # Create a text area for user input
111
- STATEMENT = st.sidebar.text_area('Enter Statement (String)', DEFAULT_STATEMENT, height=150)
112
 
113
  # Enable the button only if there is text in the SENTIMENT variable
114
  if STATEMENT:
115
- if st.sidebar.button('Summarize Statement'):
116
  # Call your Summarize function here
117
- st.write('\n\n')
118
  summary = summarizer(STATEMENT, max_length=500, min_length=30, do_sample=False)
119
- st.write(summary[0]['summary_text'])
120
  #summarize_statement(STATEMENT) # Directly pass the STATEMENT
121
  else:
122
- st.sidebar.button('Summarize Statement', disabled=True)
123
  #st.warning('πŸ‘ˆ Please enter Statement!')
124
 
125
 
 
62
  #st.warning('πŸ‘ˆ Please enter Sentiment!')
63
 
64
 
65
+ ################ STATEMENT SUMMARIZATION - side bar - tokenizer #################
66
 
67
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
68
 
 
92
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
93
 
94
  # Display the summary
95
+ st.sidebar.write("**Summary:**")
96
+ st.sidebar.write(summary)
97
  else:
98
  st.sidebar.button('Summarize Statement1', disabled=True)
99
  #st.warning('πŸ‘ˆ Please enter Statement!')
 
108
  st.sidebar.markdown("<h3 style='text-align: center; font-size: 16px; background-color: white; color: black;'>Text Summarization - BART Pipeline</h3>", unsafe_allow_html=True)
109
  DEFAULT_STATEMENT = ""
110
  # Create a text area for user input
111
+ STATEMENT = st.sidebar.text_area('Enter Statement (String2)', DEFAULT_STATEMENT, height=150)
112
 
113
  # Enable the button only if there is text in the SENTIMENT variable
114
  if STATEMENT:
115
+ if st.sidebar.button('Summarize Statement2'):
116
  # Call your Summarize function here
117
+ #st.write('\n\n')
118
  summary = summarizer(STATEMENT, max_length=500, min_length=30, do_sample=False)
119
+ st.sidebar.write(summary[0]['summary_text'])
120
  #summarize_statement(STATEMENT) # Directly pass the STATEMENT
121
  else:
122
+ st.sidebar.button('Summarize Statement2', disabled=True)
123
  #st.warning('πŸ‘ˆ Please enter Statement!')
124
 
125