Spaces:
Runtime error
Runtime error
Create summarizer.py
Browse files- utils/summarizer.py +8 -0
utils/summarizer.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from utils.backend import run_llm
|
| 2 |
+
|
| 3 |
+
def summarize_text(text: str, max_len: int = 500) -> str:
|
| 4 |
+
"""Summarize a block of text/logs with LLM backend"""
|
| 5 |
+
if not text.strip():
|
| 6 |
+
return "⚠️ No content to summarize."
|
| 7 |
+
prompt = f"Summarize the following text in plain English:\n\n{text[:2000]}"
|
| 8 |
+
return run_llm(prompt)[:max_len]
|