import torch from torchvision import transforms from PIL import Image from huggingface_hub import hf_hub_download # Download model dari repo Anda repo_id = "USERNAME_ANDA/GeoX-Custom-Model" path = hf_hub_download(repo_id=repo_id, filename="pytorch_model.bin") # Load ke arsitektur model = GeoXModel() # Gunakan class yang sama dengan di atas model.load_state_dict(torch.load(path)) model.eval() # Prediksi foto baru def predict(img_path): img = Image.open(img_path).convert('RGB') preprocess = transforms.Compose([transforms.Resize(224), transforms.ToTensor()]) img_t = preprocess(img).unsqueeze(0) with torch.no_grad(): out = model(img_t) print(f"Hasil Prediksi Koordinat: {out.numpy()}") predict("test_foto.jpg")