pszemraj commited on
Commit
3ddba7d
โ€ข
1 Parent(s): 276ee99

๐Ÿšธ add warning for no input

Browse files

Signed-off-by: peter szemraj <[email protected]>

Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -85,6 +85,17 @@ def proc_submission(
85
  tr_in = input_text
86
  msg = None
87
 
 
 
 
 
 
 
 
 
 
 
 
88
  _summaries = summarize_via_tokenbatches(
89
  tr_in,
90
  model_sm if "base" in model_size.lower() else model,
 
85
  tr_in = input_text
86
  msg = None
87
 
88
+ if len(input_text) < 50:
89
+ # this is essentially a different case from the above
90
+ msg = f"""
91
+ <div style="background-color: #880808; color: white; padding: 20px;">
92
+ <h3>Warning</h3>
93
+ <p>Input text is too short to summarize. Detected {len(input_text)} characters.
94
+ Check your input as strange things may happen.</p>
95
+ </div>
96
+ """
97
+ logging.warning(msg)
98
+ history["WARNING"] = msg
99
  _summaries = summarize_via_tokenbatches(
100
  tr_in,
101
  model_sm if "base" in model_size.lower() else model,