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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Makerspace Inventory AI
|
| 3 |
+
emoji: π§
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "5.9.1"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# π§ Makerspace Inventory Management System
|
| 13 |
+
|
| 14 |
+
An intelligent, AI-powered inventory management system designed for makerspaces, workshops, and educational facilities. This system combines computer vision, natural language processing, and optimization algorithms to streamline inventory tracking and improve workspace efficiency.
|
| 15 |
+
|
| 16 |
+

|
| 17 |
+

|
| 18 |
+

|
| 19 |
+
|
| 20 |
+
## π Features
|
| 21 |
+
|
| 22 |
+
### π **Smart Check-Out System**
|
| 23 |
+
- **AI-Powered Image Recognition**: Upload photos or use your webcam to automatically identify tools and equipment
|
| 24 |
+
- **Gemini Vision AI**: Utilizes Google's Gemini 2.5 Flash model for accurate item detection
|
| 25 |
+
- **Vector Search**: ChromaDB-powered semantic search for fuzzy matching between detected items and inventory
|
| 26 |
+
- **Real-time Inventory Updates**: Automatic quantity tracking and session logging
|
| 27 |
+
- **Multi-Item Support**: Scan multiple items in a single image
|
| 28 |
+
|
| 29 |
+
### π¦ **Intelligent Item Addition**
|
| 30 |
+
- **OCR Receipt Processing**: Upload PDF or image receipts to automatically extract items
|
| 31 |
+
- **Fuzzy Matching**: Smart name matching to find items even with typos or variations
|
| 32 |
+
- **Interactive Editing**: Review and modify detected items before adding to inventory
|
| 33 |
+
- **Manual Entry**: Quick single-item updates with auto-completion
|
| 34 |
+
- **Update History**: Complete audit trail of all inventory changes
|
| 35 |
+
|
| 36 |
+
### π **Data-Driven Layout Optimization**
|
| 37 |
+
- **Pattern Mining**: Discovers which items are frequently checked out together
|
| 38 |
+
- **Association Rules**: Calculates support, confidence, and lift metrics for item pairs
|
| 39 |
+
- **Distance Optimization**: Uses greedy relocation algorithm to minimize walking distance
|
| 40 |
+
- **Visual Analytics**: Side-by-side comparison of current vs. optimized layouts
|
| 41 |
+
- **Actionable Recommendations**: Specific move suggestions with quantified benefits
|
| 42 |
+
|
| 43 |
+
## π How to Use
|
| 44 |
+
|
| 45 |
+
### Check Out Items
|
| 46 |
+
1. Click **"π Check Out Items"** on the main menu
|
| 47 |
+
2. Upload an image of items or use your webcam
|
| 48 |
+
- Or manually type item names (comma-separated)
|
| 49 |
+
3. Review detected items and adjust quantities
|
| 50 |
+
4. Confirm checkout (optionally enter user ID)
|
| 51 |
+
|
| 52 |
+
### Add Items to Inventory
|
| 53 |
+
1. Click **"π¦ Add Items"** on the main menu
|
| 54 |
+
2. **Receipt Upload Tab**:
|
| 55 |
+
- Upload a PDF or image receipt
|
| 56 |
+
- Review extracted items
|
| 57 |
+
- Check/uncheck items to include
|
| 58 |
+
- Edit quantities if needed
|
| 59 |
+
- Click "Apply Updates"
|
| 60 |
+
3. **Manual Entry Tab**:
|
| 61 |
+
- Type item name
|
| 62 |
+
- Enter quantity
|
| 63 |
+
- Click "Add to Inventory"
|
| 64 |
+
|
| 65 |
+
### Analyze Layout Efficiency
|
| 66 |
+
1. Click **"π Inventory Analysis"** on the main menu
|
| 67 |
+
2. Adjust analysis parameters:
|
| 68 |
+
- **Minimum Support**: Pattern frequency threshold (0.02 = 2%)
|
| 69 |
+
- **Top K Pairs**: Number of frequent pairs to optimize (25)
|
| 70 |
+
- **Maximum Moves**: Limit on relocations (10)
|
| 71 |
+
- **Minimum Gain**: Distance improvement threshold (0.05 units)
|
| 72 |
+
3. Click "π Run Analysis"
|
| 73 |
+
4. Review:
|
| 74 |
+
- Frequent item pairs
|
| 75 |
+
- Relocation recommendations
|
| 76 |
+
- Distance savings
|
| 77 |
+
- Visual layout comparison
|
| 78 |
+
|
| 79 |
+
## π Key Metrics Explained
|
| 80 |
+
|
| 81 |
+
### **Support**
|
| 82 |
+
Frequency of items appearing together in checkout sessions
|
| 83 |
+
- Example: 0.10 = items appear together in 10% of checkouts
|
| 84 |
+
|
| 85 |
+
### **Lift**
|
| 86 |
+
How much more likely items are checked out together vs. randomly
|
| 87 |
+
- Lift > 1: Positive correlation (should be near each other)
|
| 88 |
+
- Lift = 2: Items are 2Γ more likely to be checked out together
|
| 89 |
+
|
| 90 |
+
### **Confidence AβB**
|
| 91 |
+
Probability of checking out item B when checking out item A
|
| 92 |
+
- Example: 0.80 = 80% chance of checking B with A
|
| 93 |
+
|
| 94 |
+
### **Distance Saved**
|
| 95 |
+
Reduction in walking distance by relocating items
|
| 96 |
+
- Measured in grid units (1 unit β 1 meter)
|
| 97 |
+
|
| 98 |
+
## π οΈ Technology Stack
|
| 99 |
+
|
| 100 |
+
- **Frontend**: Gradio 5.9 (Interactive web interface)
|
| 101 |
+
- **AI/ML**:
|
| 102 |
+
- Google Gemini 2.5 Flash (Vision AI for image recognition)
|
| 103 |
+
- Sentence Transformers (Semantic embeddings)
|
| 104 |
+
- ChromaDB (Vector database for similarity search)
|
| 105 |
+
- **OCR**: Tesseract + Pytesseract
|
| 106 |
+
- **Data Processing**: Pandas, NumPy
|
| 107 |
+
- **Optimization**: Custom greedy algorithm for layout optimization
|
| 108 |
+
- **Visualization**: Matplotlib
|
| 109 |
+
- **Fuzzy Matching**: RapidFuzz
|
| 110 |
+
|
| 111 |
+
## π File Structure
|
| 112 |
+
|
| 113 |
+
```
|
| 114 |
+
.
|
| 115 |
+
βββ app.py # Main application file
|
| 116 |
+
βββ requirements.txt # Python dependencies
|
| 117 |
+
βββ README.md # This file
|
| 118 |
+
βββ items.csv # Inventory database
|
| 119 |
+
βββ locations.csv # Physical location grid
|
| 120 |
+
βββ checkouts.csv # Checkout history
|
| 121 |
+
βββ update_log.csv # Inventory update log
|
| 122 |
+
βββ screwdriver.png # Example checkout image
|
| 123 |
+
βββ mcmaster_receipt.pdf # Example receipt
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## π§ Local Setup
|
| 127 |
+
|
| 128 |
+
### Prerequisites
|
| 129 |
+
- Python 3.10 or higher
|
| 130 |
+
- Tesseract OCR installed on your system
|
| 131 |
+
|
| 132 |
+
### Installation
|
| 133 |
+
|
| 134 |
+
1. Clone the repository:
|
| 135 |
+
```bash
|
| 136 |
+
git clone <repository-url>
|
| 137 |
+
cd makerspace-inventory
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
2. Install system dependencies (Ubuntu/Debian):
|
| 141 |
+
```bash
|
| 142 |
+
sudo apt-get update
|
| 143 |
+
sudo apt-get install -y tesseract-ocr poppler-utils
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
3. Install Python dependencies:
|
| 147 |
+
```bash
|
| 148 |
+
pip install -r requirements.txt
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
4. Run the application:
|
| 152 |
+
```bash
|
| 153 |
+
python app.py
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
5. Open your browser to `http://localhost:7860`
|
| 157 |
+
|
| 158 |
+
### Environment Variables
|
| 159 |
+
The Gemini API key is currently hardcoded. For production use, set it as an environment variable:
|
| 160 |
+
```bash
|
| 161 |
+
export GEMINI_API_KEY="your-api-key-here"
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
## π Data Format
|
| 165 |
+
|
| 166 |
+
### items.csv
|
| 167 |
+
```csv
|
| 168 |
+
item_id,item_name,category,quantity,unit,description,location_id
|
| 169 |
+
I0001,Hex Key Set,Hand Tools,12,sets,Standard SAE hex key sets,L001
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
### locations.csv
|
| 173 |
+
```csv
|
| 174 |
+
location_id,x,y,capacity
|
| 175 |
+
L001,0,0,1
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
### checkouts.csv
|
| 179 |
+
```csv
|
| 180 |
+
timestamp,user_id,session_id,item_id
|
| 181 |
+
2025-12-05T10:30:00Z,U0001,S00001,I0001
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
## π― Use Cases
|
| 185 |
+
|
| 186 |
+
- **Makerspaces & Fab Labs**: Track tools and equipment usage
|
| 187 |
+
- **Educational Workshops**: Monitor student equipment checkouts
|
| 188 |
+
- **Tool Libraries**: Manage community tool sharing
|
| 189 |
+
- **Research Labs**: Optimize equipment layout based on usage patterns
|
| 190 |
+
- **Manufacturing Facilities**: Improve tool room efficiency
|
| 191 |
+
|
| 192 |
+
## π€ Contributing
|
| 193 |
+
|
| 194 |
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
| 195 |
+
|
| 196 |
+
### Development Roadmap
|
| 197 |
+
- [ ] Barcode/QR code scanning
|
| 198 |
+
- [ ] User authentication system
|
| 199 |
+
- [ ] Advanced analytics dashboard
|
| 200 |
+
- [ ] Mobile app integration
|
| 201 |
+
- [ ] Multi-location support
|
| 202 |
+
- [ ] Automated reorder suggestions
|
| 203 |
+
- [ ] Integration with purchasing systems
|
| 204 |
+
|
| 205 |
+
## π License
|
| 206 |
+
|
| 207 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
| 208 |
+
|
| 209 |
+
## π₯ Authors
|
| 210 |
+
|
| 211 |
+
Developed as part of a makerspace automation project.
|
| 212 |
+
|
| 213 |
+
## π Acknowledgments
|
| 214 |
+
|
| 215 |
+
- Google Gemini AI for vision capabilities
|
| 216 |
+
- Anthropic Claude for development assistance
|
| 217 |
+
- Open-source community for amazing tools and libraries
|
| 218 |
+
|
| 219 |
+
## π Support
|
| 220 |
+
|
| 221 |
+
For questions, issues, or feature requests, please open an issue on GitHub or contact the development team.
|
| 222 |
+
|
| 223 |
+
---
|
| 224 |
+
|
| 225 |
+
**Built with β€οΈ for makers, by makers**
|