TanishaGupta30/layout-optima
0
๐จ Layout-Optima
AI-Driven UI/UX Layout Optimisation โ Scaler ร Meta ร HuggingFace Hackathon submission.
Simulates CRO (Conversion Rate Optimisation) by letting an agent rearrange webpage components to maximise engagement and conversion scores across 3 tasks of increasing difficulty.
Tasks
Observation Space
{
"task_id": "cta_visibility",
"task_description": "Move the CTA button above the fold (index < 2)...",
"step": 0,
"max_steps": 20,
"score": 0.2,
"components": [
{
"id": "CTA_BUTTON",
"type": "cta",
"label": "Sign Up Free",
"index": 5,
"dwell_time": 1.1,
"click_count": 22,
"conversion_rate": 0.41,
"scroll_depth": 0.15
}
],
"heatmap_summary": {
"top_dwell_time": [...],
"friction_points": [...],
"trust_signals": [...],
"cta_components": [...]
},
"available_actions": ["move_component", "change_color", "remove_component"]
}Action Space
{"type": "move_component", "id": "<component_id>", "new_index": 1}
{"type": "change_color", "id": "<component_id>", "hex": "#FF5733"}
{"type": "remove_component","id": "<component_id>"}Reward
HTTP API (OpenEnv spec)
Environment Variables
Run Locally
bash $env:ENVBASEURL = "https://tanishagupta30-layout-optima.hf.space"
> python inference.py
File Structure
โโโ app.py # FastAPI + Gradio server (OpenEnv endpoints + web UI)
โโโ env.py # LayoutOptimaEnv โ reset/step/state/grade logic
โโโ inference.py # Inference runner with [START]/[STEP]/[END] logs
โโโ tasks.py # Component dataclass + 3 task definitions
โโโ openenv.yaml # OpenEnv spec manifest
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Container definition
โโโ README.md # This file