Views
No views yet
1import streamlit as st
2import torch
3from huggingface_hub import hf_hub_download
4
5# Download model
6@st.cache_resource
7def load_model():
8 model_path = hf_hub_download(
9 repo_id="cwlachap/hrnet-cephalometric-landmark-detection",
10 filename="best_model.pth"
11 )
12
13 # Load your HRNet model here
14 model = get_hrnet_w32(config)
15 checkpoint = torch.load(model_path, map_location='cpu')
16 model.load_state_dict(checkpoint['model_state_dict'])
17 model.eval()
18 return model
19
20model = load_model()1import torch
2from huggingface_hub import hf_hub_download
3
4# Download model
5model_path = hf_hub_download(
6 repo_id="cwlachap/hrnet-cephalometric-landmark-detection",
7 filename="best_model.pth"
8)
9
10# Load model
11model = get_hrnet_w32(config)
12checkpoint = torch.load(model_path, map_location='cpu')
13model.load_state_dict(checkpoint['model_state_dict'])
14model.eval()
15
16# Perform inference
17with torch.no_grad():
18 landmarks = model(input_image)1@misc{hrnet-cephalometric-2024,
2 title={HRNet for Cephalometric Landmark Detection},
3 author={cwlachap},
4 year={2024},
5 url={https://huggingface.co/cwlachap/hrnet-cephalometric-landmark-detection}
6}