richardorama commited on
Commit
9e19736
β€’
1 Parent(s): 8cf4aa8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -7
app.py CHANGED
@@ -18,10 +18,10 @@ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
18
  # 2010 marriage license application, according to court documents.
19
  # """
20
 
21
- DEFAULT_ARTICLE = ""
22
 
23
- # Create a text area for user input
24
- ARTICLE = st.sidebar.text_area('Enter Article (String)', DEFAULT_ARTICLE, height=150)
25
 
26
  # Define the summarization function
27
  def summarize(txt):
@@ -31,11 +31,25 @@ def summarize(txt):
31
  summary = summarizer(txt, max_length=130, min_length=30, do_sample=False)
32
  st.write(summary[0]['summary_text'])
33
 
34
- # Create a button and trigger the summarize function when clicked
35
- if st.sidebar.button('Summarize Article'):
36
- summarize(ARTICLE)
 
 
 
 
 
 
 
37
  else:
38
- st.warning('πŸ‘ˆ Please enter Article!')
 
 
 
 
 
 
 
39
 
40
 
41
 
 
18
  # 2010 marriage license application, according to court documents.
19
  # """
20
 
21
+ # DEFAULT_STATEMENT = ""
22
 
23
+ # # Create a text area for user input
24
+ # STATEMENT = st.sidebar.text_area('Enter Article (String)', DEFAULT_ARTICLE, height=150)
25
 
26
  # Define the summarization function
27
  def summarize(txt):
 
31
  summary = summarizer(txt, max_length=130, min_length=30, do_sample=False)
32
  st.write(summary[0]['summary_text'])
33
 
34
+ DEFAULT_STATEMENT = ""
35
+ # Create a text area for user input
36
+ STATEMENT = st.sidebar.text_area('Enter Statement (String or List of Strings)', DEFAULT_STATEMENT, height=150)
37
+
38
+ # Enable the button only if there is text in the SENTIMENT variable
39
+ if STATEMENT:
40
+ if st.sidebar.button('Summarize Statement'):
41
+ # Call your Summarize function here
42
+ #st.write(f"Summarizing: {STATEMENT}")
43
+ summarize(STATEMENT) # Directly pass the STATEMENT
44
  else:
45
+ st.sidebar.button('Summarize Statement', disabled=True)
46
+ st.warning('πŸ‘ˆ Please enter Statement!')
47
+
48
+ # # Create a button and trigger the summarize function when clicked
49
+ # if st.sidebar.button('Summarize Article'):
50
+ # summarize(ARTICLE)
51
+ # else:
52
+ # st.warning('πŸ‘ˆ Please enter Article!')
53
 
54
 
55