Spaces:
Runtime error
Runtime error
Download test_model_load.py from jerrynnms/scam-detector: direct link, hf CLI and curl.
- Browser
- Download file 339 Bytes
-
https://huggingface.co/spaces/jerrynnms/scam-detector/resolve/main/test_model_load.py
- Command line
-
hf download hf://spaces/jerrynnms/scam-detector/test_model_load.py
-
curl -L -o test_model_load.py https://huggingface.co/spaces/jerrynnms/scam-detector/resolve/main/test_model_load.py
339 Bytes
| import torch | |
| from AI_Model_architecture import BertLSTM_CNN_Classifier | |
| try: | |
| print("🚀 嘗試載入模型...") | |
| model = BertLSTM_CNN_Classifier() | |
| model.load_state_dict(torch.load("model.pth", map_location="cpu")) | |
| print("✅ 模型成功載入!") | |
| except Exception as e: | |
| print("❌ 錯誤訊息:", str(e)) | |