Spaces:
Sleeping
Sleeping
metadata
title: Card Id Counter
emoji: π
colorFrom: blue
colorTo: blue
sdk: gradio
sdk_version: 5.11.0
app_file: app.py
pinned: false
short_description: Cameroon Card ID Counter
Voter Card Verification System
Overview
This project is a web-based application for verifying voter card numbers using machine learning and database storage. Users upload an image of their voter card along with the card number. The application uses GroqCloud's LLM to verify:
- If the provided number appears on the card.
- If the card is of Cameroonian origin (by checking for the presence of "Cameroun" on the card).
If the verification is successful, the card number is saved in a local SQLite database.
Features
- Image and Text Verification : Validates the voter card number and checks the origin of the card using GroqCloud's LLM with vision capabilities.
- Database Integration : Stores verified card numbers in a SQLite database, ensuring uniqueness.
- User-Friendly Interface : Provides an intuitive interface built with Gradio for easy interaction.
Installation and Setup
Prerequisites
- Python 3.8 or later.
- Required Python packages:
gradio
pillow
sqlite3
(part of Python's standard library)groq
(GroqCloud Python SDK)base64
(part of Python's standard library)
Steps
- Clone this repository:
git clone https://github.com/your-repo/voter-card-verification.git cd voter-card-verification
- Install the required packages:
pip install -r requirements.txt
- Set up your GroqCloud API key:
- Add your GroqCloud API key as an environment variable:
export GROQ_API_KEY="your-api-key"
- Specify the model ID as an environment variable:
export GROQ_MODEL_ID="llama-3.2-11b-vision-preview"
- Add your GroqCloud API key as an environment variable:
- Run the application:
python app.py
How It Works
- Initialization :
- A SQLite database (
voter_cards.db
) is created to store voter card numbers. - The GroqCloud client is initialized using the API key.
- User Interaction :
- Users upload an image of their voter card and enter the card number in the Gradio interface.
- The image is converted to a base64-encoded string to send to the GroqCloud LLM.
- Verification :
- The GroqCloud LLM is queried to check if:
- The provided number appears on the card.
- The card contains the word "Cameroun" to confirm its origin.
- The model responds with
true
if both conditions are met; otherwise, it responds withfalse
.
- Database Storage :
- If verification succeeds, the card number is stored in the SQLite database. Duplicate entries are prevented.
- Output :
- Users receive feedback on whether the verification succeeded or failed.
Project Structure
voter-card-verification/
β
βββ app.py # Main application file
βββ requirements.txt # Python dependencies
βββ voter_cards.db # SQLite database (auto-created on first run)
βββ README.md # Project documentation
Usage
- Open the application in your browser after launching it.
- Upload an image of your voter card.
- Enter the voter card number.
- View the result of the verification.
Notes
- Ensure the uploaded image is clear and readable.
- This application is tailored for verifying voter cards specific to Cameroon.
Future Enhancements
- Integration with Firebase for cloud-based storage.
- Improved OCR fallback for local verification.
- Support for additional countries and card types.
License
This project is licensed under the MIT License. See the LICENSE
file for details.
Acknowledgments
For any questions or issues, feel free to open an issue in the repository.