pszemraj commited on
Commit
3094ba9
โ€ข
1 Parent(s): cc0f972

๐Ÿšธ auto-return error for no text

Browse files

Signed-off-by: peter szemraj <peterszemraj@gmail.com>

Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -80,6 +80,21 @@ def proc_submission(
80
  tr_in = input_text
81
  msg = None
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  _summaries = summarize_via_tokenbatches(
84
  tr_in,
85
  model_sm if "base" in model_size.lower() else model,
 
80
  tr_in = input_text
81
  msg = None
82
 
83
+ if len(input_text) < 50:
84
+ # this is essentially a different case from the above
85
+ msg = f"""
86
+ <div style="background-color: #880808; color: white; padding: 20px;">
87
+ <h3>Error</h3>
88
+ <p>Input text is too short to summarize. Detected {len(input_text)} characters.
89
+ Please load text by selecting an example from the dropdown menu or by pasting text into the text box.</p>
90
+ </div>
91
+ """
92
+ logging.warning(msg)
93
+ logging.warning("RETURNING EMPTY STRING")
94
+ history["WARNING"] = msg
95
+
96
+ return msg, "", []
97
+
98
  _summaries = summarize_via_tokenbatches(
99
  tr_in,
100
  model_sm if "base" in model_size.lower() else model,