File size: 5,012 Bytes
f61db78
 
 
 
 
 
 
 
 
 
bbc1784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
title: Smart Tiffin Packer
emoji: ๐Ÿฑ
colorFrom: yellow
colorTo: green
sdk: docker
app_port: 7860
pinned: false
---

# Smart Tiffin Packing Environment ๐Ÿฑ๐Ÿค–

> **Semantic-aware constrained packing under real-world constraints**
>
> An OpenEnv-compliant RL environment where an LLM agent controls a robotic arm
> to pack an Indian tiffin meal. The agent uses VLM-derived food classification
> to reason about container compatibility, volume constraints, temperature zones,
> and fragility โ€” then physically executes packing decisions.

## ๐ŸŽฏ What is this?

This environment simulates the real-world task of **packing an Indian meal into tiffin containers**. An AI agent must:

1. **Identify** food items using a Vision-Language Model (VLM)
2. **Reason** about which container each item should go into
3. **Execute** packing commands via a robotic arm
4. **Satisfy** multiple constraints simultaneously

### Why Tiffin Packing?

Every day, millions of people in India pack tiffin boxes for lunch. It's a genuine spatial-reasoning task with real constraints:
- Liquids (sambar, dal) must go in sealed containers
- Fragile items (papad, chapati) shouldn't be crushed
- Hot and cold foods should be separated
- Volume limits mean you can't just stuff everything in one box

## ๐Ÿ—๏ธ Architecture

```
LLM Agent (via OpenAI API)
    โ”‚
    โ”œโ”€โ”€ observe โ†’ See scene description
    โ”œโ”€โ”€ identify โ†’ VLM classifies food item
    โ”œโ”€โ”€ pick โ†’ Robotic arm picks up food
    โ”œโ”€โ”€ place โ†’ Place item in container
    โ””โ”€โ”€ pour โ†’ Pour liquid into container
    โ”‚
    โ–ผ
OpenEnv Server (FastAPI)
    โ”‚
    โ”œโ”€โ”€ Simulation Engine (logic + PyBullet physics)
    โ”œโ”€โ”€ VLM Classifier (cached food_db.json)
    โ”œโ”€โ”€ Task Manager (easy/medium/hard)
    โ””โ”€โ”€ Deterministic Grader (0.0-1.0)
```

## ๐ŸŽฎ Tasks

| Task | Items | Containers | Constraints | Difficulty |
|------|-------|-----------|-------------|------------|
| ๐ŸŸข Easy | rice, sambar (2) | sealed, flat (2) | Type matching | Straightforward |
| ๐ŸŸก Medium | rice, sambar, chapati, pickle (4) | sealed, flat, deep (3) | Types + overflow + temperature | Requires reasoning |
| ๐Ÿ”ด Hard | rice, sambar, curd, chapati, papad, curry (6) | sealed, flat, deep, small_sealed (4) | All constraints active | Genuinely challenging |

## ๐Ÿ“Š Scoring (0.0 โ€“ 1.0)

| Component | Weight | Description |
|-----------|--------|-------------|
| Validity | 40% | Food placed in type-compatible container? |
| Efficiency | 30% | Space utilization vs capacity used |
| Constraints | 20% | Temperature, fragility, flavor isolation |
| Neatness | 10% | All items packed? Nothing dropped? |

## ๐Ÿš€ Quick Start

### Run locally
```bash
pip install -r requirements.txt
uvicorn server.app:app --host 0.0.0.0 --port 7860
```

### Run inference
```bash
export API_BASE_URL=https://api.openai.com/v1
export MODEL_NAME=gpt-4o
export HF_TOKEN=your-api-key
export ENV_URL=http://localhost:7860
python inference.py
```

### Docker
```bash
docker build -t tiffin-packer .
docker run -p 7860:7860 tiffin-packer
```

## ๐Ÿ”ง Action Space

```json
{
  "command": "identify | pick | place | pour | observe",
  "target_id": 1
}
```

## ๐Ÿ‘๏ธ Observation Space

```json
{
  "scene_description": "Natural language scene state",
  "food_items": [{"id": 1, "name": "rice", "status": "on_table", ...}],
  "containers": [{"id": 1, "type": "sealed_round", "capacity_ml": 300, ...}],
  "held_item": null,
  "vlm_result": {"type": "solid", "fragility": 0.1, ...},
  "available_commands": ["observe", "identify", "pick"],
  "step_feedback": "Successfully picked up rice"
}
```

## ๐Ÿ“ Project Structure

```
tiffen-packer/
โ”œโ”€โ”€ openenv.yaml          # OpenEnv manifest
โ”œโ”€โ”€ inference.py           # LLM inference script (OpenAI Client)
โ”œโ”€โ”€ Dockerfile             # HF Spaces deployment
โ”œโ”€โ”€ tiffin_packer/         # Core package
โ”‚   โ”œโ”€โ”€ models.py          # Pydantic Action/Observation/State
โ”‚   โ”œโ”€โ”€ simulation/
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py      # Logic simulation engine
โ”‚   โ”‚   โ””โ”€โ”€ pybullet_renderer.py  # Physics visualization
โ”‚   โ”œโ”€โ”€ vlm/
โ”‚   โ”‚   โ”œโ”€โ”€ classifier.py  # VLM food classifier
โ”‚   โ”‚   โ””โ”€โ”€ food_db.json   # 15 Indian food items
โ”‚   โ”œโ”€โ”€ tasks.py           # Easy/Medium/Hard task configs
โ”‚   โ””โ”€โ”€ grader.py          # Deterministic scoring
โ””โ”€โ”€ server/
    โ”œโ”€โ”€ tiffin_environment.py  # OpenEnv Environment
    โ””โ”€โ”€ app.py                 # FastAPI server
```

## ๐Ÿ† OpenEnv Compliance

- โœ… Typed Pydantic models (Action, Observation, State)
- โœ… `step()` / `reset()` / `state()` API
- โœ… `openenv.yaml` manifest
- โœ… 3 tasks with deterministic graders (0.0โ€“1.0)
- โœ… Dense reward function with partial progress signals
- โœ… Baseline inference script using OpenAI Client
- โœ… Docker deployment for HF Spaces

## ๐Ÿ‘ฅ Team

**CtrlAltWin** โ€” Meta PyTorch OpenEnv Hackathon 2026

## ๐Ÿ“„ License

MIT