Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,6 +93,10 @@ def summarize_abstract(abstract: str) -> str:
|
|
| 93 |
return "Summarizer not initialized. Check initialization status."
|
| 94 |
|
| 95 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
summary = summarizer(abstract, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
|
| 97 |
return summary
|
| 98 |
except Exception as e:
|
|
|
|
| 93 |
return "Summarizer not initialized. Check initialization status."
|
| 94 |
|
| 95 |
try:
|
| 96 |
+
# Check if the abstract is empty or too short
|
| 97 |
+
if not abstract or len(abstract.strip()) < 50:
|
| 98 |
+
return "Abstract too short to summarize."
|
| 99 |
+
|
| 100 |
summary = summarizer(abstract, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
|
| 101 |
return summary
|
| 102 |
except Exception as e:
|