Views
No views yet
| Property | Value |
|---|---|
| Base Model | bert-base-uncased |
| Task | Text Classification (Binary) |
| Tokenizer | BertTokenizer |
| Max Sequence Length | 512 |
| Language | English |
| Domain | Medical / Pharmaceutical |
| Label | Description |
|---|---|
VALID_PRESCRIPTION | Input is a legitimate medical prescription |
INVALID | Input is not a valid prescription |
1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="Samay-Verse/prescription-classifier"
6)
7
8result = classifier("Tab. Amoxicillin 500mg - 1 tablet twice daily for 5 days. Dr. Sharma")
9print(result)
10# [{'label': 'VALID_PRESCRIPTION', 'score': 0.97}]1from transformers import BertTokenizer, BertForSequenceClassification
2import torch
3
4model_name = "Samay-Verse/prescription-classifier"
5tokenizer = BertTokenizer.from_pretrained(model_name)
6model = BertForSequenceClassification.from_pretrained(model_name)
7
8text = "Tab. Paracetamol 650mg - 1 tablet SOS. Sig: after food."
9inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 prediction = torch.argmax(outputs.logits, dim=1).item()
14
15print("Valid Prescription" if prediction == 1 else "Invalid")Customer uploads prescription
↓
OCR / Text Extraction
↓
prescription-classifier (this model)
↓
VALID → Order proceeds
INVALID → User prompted to re-uploadbert-base-uncasedBertTokenizer, max length 512