Downloads · 30 days
25
22% of all-time downloads
manaspros/indian-receipt-parser-v1
indian-receipt-parser-v1 is a text generation model from manaspros. Use it when you need the model to write or continue text. It is set up for peft.
Indian Receipt Parser is a fine-tuned Llama 3.1 8B model specialized in parsing receipts from 50+ popular Indian vendors. It extracts vendor name, amount, date, and category from receipt text and returns structured JS…
Downloads · 30 days
25
22% of all-time downloads
All-time downloads
113
Public
Repo size
185 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 91%
From the Hugging Face model README
Indian Receipt Parser is a fine-tuned Llama 3.1 8B model specialized in parsing receipts from 50+ popular Indian vendors. It extracts vendor name, amount, date, and category from receipt text and returns structured JSON output.
Food Delivery & Dining (9): Zomato, Swiggy, EatSure, Dominos, McDonald's, KFC, Burger King, Pizza Hut, Foodpanda
Quick Commerce & Groceries (7): BigBasket, Blinkit, Zepto, Swiggy Instamart, Dunzo, JioMart, DMart Ready
E-commerce & Shopping (8): Amazon India, Flipkart, Myntra, Meesho, Ajio, Nykaa, Snapdeal, Tata CLiQ
Transportation (6): Ola, Uber, Rapido, Namma Yatri, BluSmart, InDrive
FinTech & Payments (7): Paytm, PhonePe, GooglePay, MobiKwik, Freecharge, Amazon Pay, CRED
Healthcare (5): Apollo Pharmacy, 1mg, PharmEasy, Netmeds, MedLife
Entertainment (8): BookMyShow, PVR INOX, Netflix, Amazon Prime, Disney+ Hotstar, Jio Cinema, ZEE5, Sony LIV
Travel (5): MakeMyTrip, Goibibo, IRCTC, OYO, EaseMyTrip
Telecom (3): Jio, Airtel, Vi (Vodafone Idea)
pip install transformers torch peft
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load model
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
device_map="auto",
torch_dtype=torch.bfloat16
)
model = PeftModel.from_pretrained(base_model, "path/to/indian-receipt-parser-v1/final")
# Parse receipt
receipt_text = """
Thank you for ordering from Zomato
Order Date: 15/11/2024
Subtotal: ₹450
Tax: ₹81
Total: ₹531
"""
messages = [
{
"role": "system",
"content": "You are a financial receipt parser specialized in Indian vendors. Extract vendor name, amount, date, and category from receipts. Return ONLY valid JSON in this exact format: {\"vendor\": \"VendorName\", \"amount\": 0.0, \"date\": \"YYYY-MM-DD\", \"category\": \"category\", \"tax\": 0.0, \"currency\": \"INR\", \"confidence\": 0.0}"
},
{
"role": "user",
"content": receipt_text
}
]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.1)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
{
"vendor": "Zomato",
"amount": 531.0,
"date": "2024-11-15",
"category": "dining",
"tax": 81.0,
"currency": "INR",
"confidence": 0.95
}
Initial loss: 2.64
Final loss: 0.13
Improvement: 95%
If you use this model, please cite:
@misc{indian-receipt-parser-v1,
title={Indian Receipt Parser v1.0},
author={Your Name},
year={2024},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/your-username/indian-receipt-parser-v1}}
}
This model is released under the Llama 3.1 Community License.
For issues, questions, or suggestions:
Built with:
Made with ❤️ for India's fintech community!