Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -242,6 +242,13 @@ async def extract_tokens(pages_data, progress=gr.Progress()):
|
|
| 242 |
state.log(f" Radius: {len(state.desktop_raw.radius)} values")
|
| 243 |
state.log(f" Shadows: {len(state.desktop_raw.shadows)} values")
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
# Log CSS variables if found
|
| 246 |
if hasattr(desktop_extractor, 'css_variables') and desktop_extractor.css_variables:
|
| 247 |
state.log("")
|
|
@@ -920,6 +927,7 @@ async def run_stage2_analysis_v2(
|
|
| 920 |
radius_tokens=desktop_dict.get("radius", {}),
|
| 921 |
shadow_tokens=desktop_dict.get("shadows", {}),
|
| 922 |
log_callback=state.log,
|
|
|
|
| 923 |
)
|
| 924 |
|
| 925 |
state.rule_engine_results = rule_results
|
|
@@ -996,7 +1004,7 @@ async def run_stage2_analysis_v2(
|
|
| 996 |
if benchmarks and rule_results:
|
| 997 |
benchmark_comparisons = researcher.compare_to_benchmarks(
|
| 998 |
your_ratio=rule_results.typography.detected_ratio,
|
| 999 |
-
your_base_size=int(rule_results.typography.
|
| 1000 |
your_spacing_grid=rule_results.spacing.detected_base,
|
| 1001 |
benchmarks=benchmarks,
|
| 1002 |
log_callback=state.log,
|
|
@@ -1068,7 +1076,7 @@ async def run_stage2_analysis_v2(
|
|
| 1068 |
try:
|
| 1069 |
benchmark_advice = await benchmark_agent.analyze(
|
| 1070 |
user_ratio=rule_results.typography.detected_ratio,
|
| 1071 |
-
user_base=int(rule_results.typography.
|
| 1072 |
user_spacing=rule_results.spacing.detected_base,
|
| 1073 |
benchmark_comparisons=benchmark_comparisons,
|
| 1074 |
log_callback=state.log,
|
|
|
|
| 242 |
state.log(f" Radius: {len(state.desktop_raw.radius)} values")
|
| 243 |
state.log(f" Shadows: {len(state.desktop_raw.shadows)} values")
|
| 244 |
|
| 245 |
+
# Store foreground-background pairs for real AA checking in Stage 2
|
| 246 |
+
if hasattr(desktop_extractor, 'fg_bg_pairs') and desktop_extractor.fg_bg_pairs:
|
| 247 |
+
state.fg_bg_pairs = desktop_extractor.fg_bg_pairs
|
| 248 |
+
state.log(f" FG/BG Pairs: {len(state.fg_bg_pairs)} unique pairs for AA checking")
|
| 249 |
+
else:
|
| 250 |
+
state.fg_bg_pairs = []
|
| 251 |
+
|
| 252 |
# Log CSS variables if found
|
| 253 |
if hasattr(desktop_extractor, 'css_variables') and desktop_extractor.css_variables:
|
| 254 |
state.log("")
|
|
|
|
| 927 |
radius_tokens=desktop_dict.get("radius", {}),
|
| 928 |
shadow_tokens=desktop_dict.get("shadows", {}),
|
| 929 |
log_callback=state.log,
|
| 930 |
+
fg_bg_pairs=getattr(state, 'fg_bg_pairs', None),
|
| 931 |
)
|
| 932 |
|
| 933 |
state.rule_engine_results = rule_results
|
|
|
|
| 1004 |
if benchmarks and rule_results:
|
| 1005 |
benchmark_comparisons = researcher.compare_to_benchmarks(
|
| 1006 |
your_ratio=rule_results.typography.detected_ratio,
|
| 1007 |
+
your_base_size=int(rule_results.typography.base_size) if rule_results.typography.sizes_px else 16,
|
| 1008 |
your_spacing_grid=rule_results.spacing.detected_base,
|
| 1009 |
benchmarks=benchmarks,
|
| 1010 |
log_callback=state.log,
|
|
|
|
| 1076 |
try:
|
| 1077 |
benchmark_advice = await benchmark_agent.analyze(
|
| 1078 |
user_ratio=rule_results.typography.detected_ratio,
|
| 1079 |
+
user_base=int(rule_results.typography.base_size) if rule_results.typography.sizes_px else 16,
|
| 1080 |
user_spacing=rule_results.spacing.detected_base,
|
| 1081 |
benchmark_comparisons=benchmark_comparisons,
|
| 1082 |
log_callback=state.log,
|