Spaces:
Sleeping
Sleeping
Download summarizer.py from dschandra/Text_Summarize: direct link, hf CLI and curl.
- Browser
- Download file 346 Bytes
-
https://huggingface.co/spaces/dschandra/Text_Summarize/resolve/main/summarizer.py
- Command line
-
hf download hf://spaces/dschandra/Text_Summarize/summarizer.py
-
curl -L -o summarizer.py https://huggingface.co/spaces/dschandra/Text_Summarize/resolve/main/summarizer.py
346 Bytes
| from model import load_model | |
| # Initialize the model | |
| model = load_model() | |
| def summarize_text(input_text: str) -> str: | |
| """ | |
| Summarize the input text using the pre-trained Hugging Face model. | |
| """ | |
| # Get the summary | |
| summary = model(input_text, max_length=200, min_length=50, do_sample=False) | |
| return summary[0]['summary_text'] | |