Instructions to use Samay-Verse/prescription-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Samay-Verse/prescription-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Samay-Verse/prescription-classifier")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Samay-Verse/prescription-classifier", dtype="auto") - Notebooks
- Google Colab
- Kaggle
π Prescription Classifier β Sanjeevani
A fine-tuned BERT-based text classification model built for the Sanjeevani healthcare platform. It classifies whether a given text input is a valid medical prescription or not, enabling automated prescription validation in the Sanjeevani ordering and delivery pipeline.
π₯ Project Context
Sanjeevani is a full-stack healthcare platform that connects patients with pharmacies and delivery agents. It includes:
- π± Mobile App (Flutter) β for customers to browse medicines and place orders
- π₯οΈ Admin Console (React) β for pharmacy/admin management
- π Delivery App (Flutter) β for delivery agents
- π€ AI Chatbots (WhatsApp & Telegram) β for conversational ordering
- π Calling Assistant (VAPI) β voice-based ordering
- π§ This Model β prescription validation at the AI layer
This model is used by the backend services to verify uploaded prescriptions before allowing controlled medicine orders.
π§ Model Details
| Property | Value |
|---|---|
| Base Model | bert-base-uncased |
| Task | Text Classification (Binary) |
| Tokenizer | BertTokenizer |
| Max Sequence Length | 512 |
| Language | English |
| Domain | Medical / Pharmaceutical |
Labels
| Label | Description |
|---|---|
VALID_PRESCRIPTION |
Input is a legitimate medical prescription |
INVALID |
Input is not a valid prescription |
π Quick Start
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Samay-Verse/prescription-classifier"
)
result = classifier("Tab. Amoxicillin 500mg - 1 tablet twice daily for 5 days. Dr. Sharma")
print(result)
# [{'label': 'VALID_PRESCRIPTION', 'score': 0.97}]
π§ Manual Usage
from transformers import BertTokenizer, BertForSequenceClassification
import torch
model_name = "Samay-Verse/prescription-classifier"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
text = "Tab. Paracetamol 650mg - 1 tablet SOS. Sig: after food."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1).item()
print("Valid Prescription" if prediction == 1 else "Invalid")
ποΈ Integration in Sanjeevani Backend
This model is called by the Sanjeevani backend API when a customer uploads a prescription image (OCR-extracted text) or types a prescription manually via the chatbot.
Customer uploads prescription
β
OCR / Text Extraction
β
prescription-classifier (this model)
β
VALID β Order proceeds
INVALID β User prompted to re-upload
π¦ Training Details
- Base Model:
bert-base-uncased - Training Data: Curated dataset of Indian pharmaceutical prescriptions and non-prescription texts
- Preprocessing: Lowercased, tokenized with
BertTokenizer, max length 512 - Framework: HuggingFace Transformers + PyTorch
β οΈ Limitations & Disclaimer
- This model is designed for the Indian pharmaceutical context and may not generalize well to other regions.
- It is a supporting tool, not a replacement for professional medical verification.
- Always ensure compliance with local regulations when using AI for prescription validation.
- Model performance may vary on handwritten prescription OCR output.
π License
Apache 2.0 β Free to use with attribution.
π Related Resources
- π Sanjeevani Platform: Samay-Verse on HuggingFace
- π€ Base Model: bert-base-uncased
βοΈ Contact
Built and maintained by the Samay-Verse team. For issues or contributions, open a discussion on the HuggingFace model page.