Paula Leonova commited on
Commit
92c16d7
1 Parent(s): 2f8ff4d

Update text and input descriptions

Browse files
Files changed (2) hide show
  1. app.py +5 -5
  2. examples.json +1 -1
app.py CHANGED
@@ -22,11 +22,11 @@ st.header("Summzarization & Multi-label Classification for Long Text")
22
  st.write("This app summarizes and then classifies your long text with multiple labels.")
23
  st.write("__Inputs__: User enters their own custom text and labels.")
24
  st.write("__Outputs__: A summary of the text, likelihood percentages for each label and a downloadable csv of the results. \
25
- Option to evaluate results against a list of ground truth labels, if available.")
26
 
27
  with st.form(key='my_form'):
28
  example_text = ex_long_text #ex_text
29
- display_text = "[Excerpt from Project Gutenberg: Frankenstein]\n" + example_text + "\n\n" + ex_license
30
  text_input = st.text_area("Input any text you want to summarize & classify here (keep in mind very long text will take a while to process):", display_text)
31
 
32
  if text_input == display_text:
@@ -37,10 +37,10 @@ with st.form(key='my_form'):
37
  ('Yes', 'No')
38
  )
39
 
40
- labels = st.text_input('Enter possible labels (comma-separated):',ex_labels, max_chars=1000)
41
  labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
42
 
43
- glabels = st.text_input('If available, enter ground truth labels to evaluate results, otherwise leave blank (comma-separated):',ex_glabels, max_chars=1000)
44
  glabels = list(set([x.strip() for x in glabels.strip().split(',') if len(x.strip()) > 0]))
45
 
46
  threshold_value = st.slider(
@@ -64,7 +64,7 @@ with st.spinner('Loading pretrained models...'):
64
  kw_model = md.load_keyword_model()
65
  k_time = round(time.time() - start,4)
66
 
67
- st.success(f'Time taken to load BART summarizer mnli model: {s_time}s & BART classifier mnli model: {c_time}s & KeyBERT model: {k_time}s')
68
 
69
  if submit_button:
70
  if len(text_input) == 0:
22
  st.write("This app summarizes and then classifies your long text with multiple labels.")
23
  st.write("__Inputs__: User enters their own custom text and labels.")
24
  st.write("__Outputs__: A summary of the text, likelihood percentages for each label and a downloadable csv of the results. \
25
+ Includes additional options to generate a list of keywords and/or evaluate results against a list of ground truth labels, if available.")
26
 
27
  with st.form(key='my_form'):
28
  example_text = ex_long_text #ex_text
29
+ display_text = 'Excerpt from Frankenstein:' + example_text + '"\n\n' + "[This is an excerpt from Project Gutenberg's Frankenstein. " + ex_license + "]"
30
  text_input = st.text_area("Input any text you want to summarize & classify here (keep in mind very long text will take a while to process):", display_text)
31
 
32
  if text_input == display_text:
37
  ('Yes', 'No')
38
  )
39
 
40
+ labels = st.text_input('Enter possible topic labels, which can be either keywords and/or general themes (comma-separated):',ex_labels, max_chars=1000)
41
  labels = list(set([x.strip() for x in labels.strip().split(',') if len(x.strip()) > 0]))
42
 
43
+ glabels = st.text_input('If available, enter ground truth topic labels to evaluate results, otherwise leave blank (comma-separated):',ex_glabels, max_chars=1000)
44
  glabels = list(set([x.strip() for x in glabels.strip().split(',') if len(x.strip()) > 0]))
45
 
46
  threshold_value = st.slider(
64
  kw_model = md.load_keyword_model()
65
  k_time = round(time.time() - start,4)
66
 
67
+ st.success(f'Time taken to load KeyBERT model: {k_time}s & BART summarizer mnli model: {s_time}s & BART classifier mnli model: {c_time}s')
68
 
69
  if submit_button:
70
  if len(text_input) == 0:
examples.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "text": "Such were the professor’s words—rather let me say such the words of the fate—enounced to destroy me. As he went on I felt as if my soul were grappling with a palpable enemy; one by one the various keys were touched which formed the mechanism of my being; chord after chord was sounded, and soon my mind was filled with one thought, one conception, one purpose. So much has been done, exclaimed the soul of Frankenstein—more, far more, will I achieve; treading in the steps already marked, I will pioneer a new way, explore unknown powers, and unfold to the world the deepest mysteries of creation.",
3
- "long_text_license": "[This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.]",
4
  "labels":"Batman,Science,Sound,Light,Creation,Optics,Eyes,Engineering,Color,Communication,Death",
5
  "ground_labels":"Science,Sound,Light,Creation,Engineering,Communication,Death"
6
  }
1
  {
2
  "text": "Such were the professor’s words—rather let me say such the words of the fate—enounced to destroy me. As he went on I felt as if my soul were grappling with a palpable enemy; one by one the various keys were touched which formed the mechanism of my being; chord after chord was sounded, and soon my mind was filled with one thought, one conception, one purpose. So much has been done, exclaimed the soul of Frankenstein—more, far more, will I achieve; treading in the steps already marked, I will pioneer a new way, explore unknown powers, and unfold to the world the deepest mysteries of creation.",
3
+ "long_text_license": "This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.",
4
  "labels":"Batman,Science,Sound,Light,Creation,Optics,Eyes,Engineering,Color,Communication,Death",
5
  "ground_labels":"Science,Sound,Light,Creation,Engineering,Communication,Death"
6
  }