Skip to content

FurkanKhann/MedicineTransformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 T5-Based Medicine Information Extractor

This project fine-tunes a T5 Transformer model to predict the Uses and Side Effects of medicines based on their name or salt composition.


πŸ“Š Task Description

  • Input: Medicine name or salt composition
    (e.g., "Azithromycin (500mg)")

  • Output: (Uses: Treatment of Bacterial infections; Side effects: Nausea Abdominal pain Diarrhea)


πŸ—οΈ Model Architecture

  • Model: t5-small
  • Library: πŸ€— HuggingFace Transformers
  • Training Framework: PyTorch
  • Data Size: ~11,000 medicine records
  • Format: Custom dataset with fields:
  • Composition (input)
  • Uses (output)
  • Side effects (output)

πŸ“ Model Files

t5_medicine_model/
β”œβ”€β”€ config.json
β”œβ”€β”€ pytorch_model.bin
β”œβ”€β”€ tokenizer_config.json
β”œβ”€β”€ special_tokens_map.json
β”œβ”€β”€ spiece.model
β”œβ”€β”€ generation_config.json

πŸ”— Download from Google Drive

πŸ“¦ How to Use the Model

from transformers import T5Tokenizer, T5ForConditionalGeneration

# Load from local path (after downloading from Google Drive)
model_path = "./t5_medicine_model"

tokenizer = T5Tokenizer.from_pretrained(model_path)
model = T5ForConditionalGeneration.from_pretrained(model_path)
model.eval()

# Inference
input_text = "Azithromycin (500mg)"
inputs = tokenizer(input_text, return_tensors="pt")

output_ids = model.generate(
    **inputs,
    max_length=128,
    decoder_start_token_id=model.config.decoder_start_token_id
)

result = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print("Prediction:", result)

🧠 Future Work

  • Deploy as an API using FastAPI or Flask
  • Add a web UI using Gradio or Streamlit
  • Improve accuracy using larger Transformer models
  • Add confidence scores or implement partial matching

πŸ§‘β€πŸ’» Author

Furkan Khan
Model trained locally using Python, HuggingFace Transformers, and PyTorch

πŸ“œ Certification

This project was built and trained by Khan F as part of a personal initiative to explore Natural Language Processing using:

  • βœ… Python
  • βœ… HuggingFace Transformers
  • βœ… PyTorch

All training and testing were performed locally.
This repository serves as a showcase of model development, deployment planning, and ongoing improvements in NLP.

πŸ“Œ This project is not officially certified by any institution and is intended for educational and demonstrative purposes.

About

Fine-tuned T5 Transformer model that predicts the uses and side effects of medicines from their name or salt composition. Trained on 11K+ real-world entries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors