Paula Leonova commited on
Commit
eb0efc1
1 Parent(s): 9bdc126
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -36,9 +36,19 @@ else:
36
  input_glabels = ''
37
 
38
 
 
39
  with st.form(key='my_form'):
40
- 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)
41
-
 
 
 
 
 
 
 
 
 
42
  gen_keywords = st.radio(
43
  "Generate keywords from text?",
44
  ('Yes', 'No')
@@ -81,7 +91,7 @@ if submit_button or example_button:
81
  if len(text_input) == 0:
82
  st.error("Enter some text to generate a summary")
83
  else:
84
- with st.spinner('Breaking up text into more reasonable chunks (tranformers cannot exceed a 1024 token max)...'):
85
  # For each body of text, create text chunks of a certain token size required for the transformer
86
  nested_sentences = md.create_nest_sentences(document = text_input, token_max_length = 1024)
87
  # For each chunk of sentences (within the token max)
 
36
  input_glabels = ''
37
 
38
 
39
+
40
  with st.form(key='my_form'):
41
+ text_input_method = st.radio(
42
+ "Text Input Method",
43
+ ('Free form text', 'CSV')
44
+ )
45
+
46
+ if text_input_method == "Free form text":
47
+ 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)
48
+ else:
49
+ uploaded_file = st.file_uploader("Choose a CSV file",
50
+ help='Upload a CSV file with the following columns: ID, Text')
51
+
52
  gen_keywords = st.radio(
53
  "Generate keywords from text?",
54
  ('Yes', 'No')
 
91
  if len(text_input) == 0:
92
  st.error("Enter some text to generate a summary")
93
  else:
94
+ with st.spinner('Breaking up text into more reasonable chunks (transformers cannot exceed a 1024 token max)...'):
95
  # For each body of text, create text chunks of a certain token size required for the transformer
96
  nested_sentences = md.create_nest_sentences(document = text_input, token_max_length = 1024)
97
  # For each chunk of sentences (within the token max)