Views
No views yet
distilbert-base-uncased trained to classify medical and health-related questions into 20 distinct medical specialties (e.g., Cardiology, Pediatrics, Psychiatry, Surgery).openlifescienceai/medmcqadistilbert-base-uncased1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "mahmoodulhassan23/medical-question-classifier"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8question = "Child presenting with high grade fever, rash, and cough."
9inputs = tokenizer(question, return_tensors="pt")
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 pred_class = torch.argmax(outputs.logits, dim=-1).item()
14
15print(f"Predicted Class ID: {pred_class}")