raptor1 commited on
Commit
1af087a
·
verified ·
1 Parent(s): 2b8f94c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -21,8 +21,8 @@ Choosing a text limit for input length since the summarizer works best if the te
21
  def summarize_and_sentiment(text):
22
 
23
  # Checking if text length is at least 150 characters as I have set max_length for output token = 150
24
- if len(text) < 150:
25
- return "Error: Text should be in between 150 and 500 characters long. Please increase the length of the text.", "" #Using "" as second argument so that when an error occurs the function returns two values instead of one and this is what expected in Gradio UI.The outputs would no longer match the expected structure if we return just one outpit from function.
26
 
27
  # Generate summary using summarizer pipeline
28
  summary = summarizer_pipeline(text, min_length=4, max_length=150)
 
21
  def summarize_and_sentiment(text):
22
 
23
  # Checking if text length is at least 150 characters as I have set max_length for output token = 150
24
+ if len(text) < 150 or len(text) > 500:
25
+ return "Error: Text should be in between 150 and 500 characters long. Please increase the length of the text.", "" #Using "" as second argument so that when an error occurs the function returns two values instead of one and this is what expected in Gradio UI.The outputs would no longer match the expected structure if we return just one outpit from function.
26
 
27
  # Generate summary using summarizer pipeline
28
  summary = summarizer_pipeline(text, min_length=4, max_length=150)