Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
๐ธ auto-return error for no text
Browse filesSigned-off-by: peter szemraj <peterszemraj@gmail.com>
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,
|