Spaces:
Runtime error
Runtime error
Download summarizer/models.py from Andolinism/TelegramChatSummarizer: direct link, hf CLI and curl.
- Browser
- Download file 403 Bytes
-
https://huggingface.co/spaces/Andolinism/TelegramChatSummarizer/resolve/main/summarizer/models.py
- Command line
-
hf download hf://spaces/Andolinism/TelegramChatSummarizer/summarizer/models.py
-
curl -L -o models.py https://huggingface.co/spaces/Andolinism/TelegramChatSummarizer/resolve/main/summarizer/models.py
403 Bytes
| from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
| def load_model(): | |
| model_name = "nafisehNik/mt5-persian-summary" | |
| cache_dir = "/tmp/hf_cache" # مسیر مجاز برای Hugging Face Spaces | |
| tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir=cache_dir) | |
| model = AutoModelForSeq2SeqLM.from_pretrained(model_name, cache_dir=cache_dir) | |
| return tokenizer, model | |