Views
No views yet
1from huggingface_hub import hf_hub_download
2import torch
3import cv2
4import numpy as np
5
6# Download the handler
7handler_path = hf_hub_download(repo_id="sukhmani1303/tuberculosis-vit-model", filename="handler.py")
8
9# Import and use
10exec(open(handler_path).read())
11classifier = TBClassifier()
12
13# Load and predict
14image = cv2.imread("path/to/chest_xray.jpg")
15result = classifier.predict(image)
16print(f"Prediction: {result['prediction']}, Confidence: {result['confidence']:.4f}")1from huggingface_hub import hf_hub_download
2import torch
3import json
4
5# Download model files
6config_path = hf_hub_download(repo_id="sukhmani1303/tuberculosis-vit-model", filename="config.json")
7model_path = hf_hub_download(repo_id="sukhmani1303/tuberculosis-vit-model", filename="pytorch_model.bin")
8
9# Load configuration
10with open(config_path, 'r') as f:
11 config = json.load(f)
12
13# Initialize your ViT model class with config
14# model = ViT(**config) # You'll need to have your ViT class available
15# model.load_state_dict(torch.load(model_path, map_location='cpu'))
16# model.eval()@misc{tuberculosis-vit-model,
author = {Sukhmani},
title = {Tuberculosis Detection using Vision Transformer},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/sukhmani1303/tuberculosis-vit-model}
}