fix: handle None values in length sliders
Browse files- summarizer/summarize.py +4 -0
summarizer/summarize.py
CHANGED
|
@@ -11,6 +11,10 @@ def generate_summary(text=None, file=None, min_length=30, max_length=100, do_sam
|
|
| 11 |
|
| 12 |
if not content or len(content.split()) < INPUT_MIN_SIZE:
|
| 13 |
return "⚠️ Input too short or empty."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Model selection based on language detection
|
| 16 |
lang = detect_language(content)
|
|
|
|
| 11 |
|
| 12 |
if not content or len(content.split()) < INPUT_MIN_SIZE:
|
| 13 |
return "⚠️ Input too short or empty."
|
| 14 |
+
|
| 15 |
+
# Fallback defaults if somehow None is passed
|
| 16 |
+
min_len = min_len or 30
|
| 17 |
+
max_len = max_len or 100
|
| 18 |
|
| 19 |
# Model selection based on language detection
|
| 20 |
lang = detect_language(content)
|