Spaces:
Sleeping
Sleeping
| from smolagents import tool | |
| from transformers import pipeline | |
| summarizer = pipeline("summarization") | |
| def summarize(input: str) -> str: | |
| """ | |
| Returns a summarized version of the input text. | |
| Args: | |
| input (str): The text to be summarized. | |
| Returns: | |
| str: Concise summary of the input. | |
| """ | |
| if len(input) < 50: | |
| return input | |
| result = summarizer(input, max_length=100, min_length=25, do_sample=False) | |
| return result[0]['summary_text'] | |