CoolFace
Apppublic

TanishaGupta30/layoutgym

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

LayoutGym ๐ŸŽจ

An OpenEnv environment for AI-driven UI/UX conversion optimization.

Overview

LayoutGym simulates a landing page as a structured JSON DOM tree. An AI agent acts as a conversion-rate expert, manipulating element positions, colors, and content to maximize a Predicted Engagement Score (0.0โ€“1.0) โ€” inspired by Fitts's Law and gaze prediction models.

Observation Space

FieldTypeDescription
elementsList[UIElement]DOM elements with positions, colors, clickrate, heatscore
fold_positionintIndex of the "above the fold" boundary
scroll_depth_mapdict% scroll โ†’ drop-off rate
bounce_zonesList[int]Element position indices with high bounce
engagement_scorefloatCurrent Predicted Engagement Score (0.0โ€“1.0)

Action Space

ActionParameters
move_elementelementid, targetposition
swap_elementselementida, elementidb
change_colorelement_id, color (hex)
set_primary_buttonelement_id
change_font_sizeelementid, fontsize
insert_elementtype, label, position
remove_elementelement_id

Tasks

IDDifficultyGoal
cta_rescueEasyMove hidden CTA above the fold
visual_hierarchyMediumFix button color contrast and hierarchy
retention_loopHardInsert engaging content before bounce zone

Setup

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

Run Baseline

bash
export API_BASE_URL="https://api.openai.com/v1"
export MODEL_NAME="gpt-4o-mini"
export HF_TOKEN="your_token_here"
export ENV_URL="http://localhost:7860"
python inference.py

API Endpoints

  • โ€”GET /health โ€” Health check
  • โ€”GET /tasks โ€” List all tasks
  • โ€”POST /reset โ€” {"task_id": "cta_rescue"}
  • โ€”POST /step โ€” {"action": {...}}
  • โ€”GET /state โ€” Current environment state