Spaces:
Runtime error
Runtime error
File size: 10,175 Bytes
91772a8 7d726a4 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 d0e5c58 91772a8 ef9981b 91772a8 2b84db5 ef9981b 91772a8 | 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | """
ACO Academy Benchmark Tool - HuggingFace Space
Agent Commerce Optimization Demo
No secrets or API keys in this code - all external configuration.
"""
import gradio as gr
import os
from datetime import datetime
# Configuration (set via HF Space secrets/environment)
ACO_API_BASE = os.getenv("ACO_API_BASE", "https://agenticcommerce.academy/api")
STRIPE_CHECKOUT_BASE = os.getenv("STRIPE_CHECKOUT_BASE", "https://agenticcommerce.academy/benchmark")
# Showcase examples (pre-generated reports)
SHOWCASE_EXAMPLES = {
"amazon.com": {
"grade": "F",
"score": "49/100",
"pdf": "reports/amazon_benchmark.pdf",
"summary": "Zero ACO implementation. AI agents cannot discover Amazon's APIs."
},
"x.com": {
"grade": "D",
"score": "65/100",
"pdf": "reports/x_benchmark.pdf",
"summary": "Partial ACO support. Has agent.json and MCP, but missing structured data."
},
"shopify.com": {
"grade": "F",
"score": "57/100",
"pdf": "reports/shopify_benchmark.pdf",
"summary": "Poor overall score despite perfect SEO. Weak ACO (40/100) and security (35/100)."
},
"agenticcommerce.academy": {
"grade": "D",
"score": "61/100",
"pdf": "reports/agenticcommerce_benchmark.pdf",
"summary": "We practice what we preach - and we're still improving. Perfect SEO, moderate ACO."
}
}
def get_showcase_report(domain):
"""Return pre-generated showcase report"""
if domain not in SHOWCASE_EXAMPLES:
return None, "Select a domain to view the report"
example = SHOWCASE_EXAMPLES[domain]
summary = f"""
# {domain} - Grade {example['grade']} ({example['score']})
**{example['summary']}**
π₯ **Download the full 4-page PDF report below**
This is a complete ACO benchmark including:
- SEO Analysis
- ACO Implementation Check
- Security Scan
- Consent Audit
- CEH-RI Risk Assessment
- Prioritized Recommendations
"""
return example['pdf'], summary
def scan_domain_preview(domain):
"""
Preview scan - basic ACO check only
NOTE: This is a MOCK for demo purposes.
Real implementation calls ACO_API_BASE + /preview endpoint
"""
if not domain or len(domain) < 4:
return "β οΈ Please enter a valid domain (e.g., example.com)"
# Clean domain
domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0]
# Mock preview result (replace with actual API call)
# In production: response = requests.post(f"{ACO_API_BASE}/preview", json={"domain": domain})
preview = f"""
## π ACO Preview Report: {domain}
### Estimated Grade: F (35/100)
**Quick Findings:**
β **No agent.json detected** - AI agents cannot discover your capabilities
β **No MCP manifest found** - No Model Context Protocol support
β **No llms.txt present** - AI crawlers have no guidance
β οΈ **Basic SEO present** but not optimized for agents
β οΈ **Security headers incomplete** - Missing modern protections
---
### β οΈ Your site is invisible to AI agents
As AI-driven commerce becomes mainstream, sites without ACO will be excluded from agent transactions.
---
### π What's in the Full Report?
β
**Complete 6-category analysis** (20+ checks across SEO, ACO, Security, Consent, CEH-RI)
β
**Cognitive Event Horizon Risk Index** - Detect manipulation patterns
β
**Detailed security & consent audit** - GDPR, CCPA, ACO compliance
β
**Prioritized action plan** - Step-by-step fixes with impact scores
β
**4-page downloadable PDF** - Professional report for your team
β
**Industry benchmarks** - See how you compare
---
### π₯ Ready to see the full picture?
**One-time analysis: $99**
Complete ACO benchmark delivered instantly.
"""
return preview
def get_upgrade_link(domain):
"""Generate Stripe checkout link for full report"""
if not domain or len(domain) < 4:
return "β οΈ Please enter a domain first"
domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0]
# Construct checkout URL (no secrets - just URL params)
checkout_url = f"{STRIPE_CHECKOUT_BASE}?domain={domain}&product=aco-benchmark&price=99"
return f"""
## π Upgrade to Full Report
**Domain:** {domain}
**Price:** $99 (one-time)
**[Click here to complete checkout]({checkout_url})**
You'll receive:
- Full 4-page PDF benchmark report
- Detailed findings across all 6 categories
- Prioritized recommendations
- Access to your ACO Academy dashboard
Secure payment processed via Stripe.
"""
# Build Gradio interface
with gr.Blocks(
theme=gr.themes.Soft(
primary_hue="blue",
secondary_hue="purple"
),
title="ACO Academy | The SEO of the AI Era",
css="""
.gradio-container {max-width: 1200px !important}
.gr-button-primary {background: linear-gradient(90deg, #3B5EE9 0%, #9333EA 100%)}
"""
) as demo:
gr.Markdown("""
# ACO Academy Benchmark Tool
## The SEO of the AI Era
**Is Your Site Ready for AI Agents?**
Get a comprehensive benchmark of your site's Agent Commerce Optimization score. Find out what AI shopping agents see when they evaluate your site.
""")
# TAB 1: Showcase Examples
with gr.Tab("π Showcase Examples"):
gr.Markdown("""
## See How Major Sites Score on ACO Readiness
We've benchmarked popular platforms to show the **range** of ACO implementation.
Download full PDF reports to see what you'll receive.
""")
showcase_dropdown = gr.Dropdown(
choices=list(SHOWCASE_EXAMPLES.keys()),
label="Select a site to view full report",
value="amazon.com"
)
showcase_btn = gr.Button("π₯ View Report", variant="primary")
showcase_summary = gr.Markdown()
showcase_output = gr.File(label="Download PDF Report")
showcase_btn.click(
fn=get_showcase_report,
inputs=[showcase_dropdown],
outputs=[showcase_output, showcase_summary]
)
# TAB 2: Check Your Site
with gr.Tab("π Check Your Site"):
gr.Markdown("""
## Free Preview Scan
Get a **basic ACO check** for any domain - see your estimated grade instantly.
β οΈ **Preview includes:** ACO component detection only
π₯ **Full report includes:** SEO, Security, Consent, CEH-RI, and 20+ recommendations
""")
with gr.Row():
preview_input = gr.Textbox(
label="Enter your domain",
placeholder="example.com",
scale=3
)
preview_btn = gr.Button("π Scan Now (Free)", variant="secondary", scale=1)
preview_output = gr.Markdown()
gr.Markdown("---")
upgrade_btn = gr.Button("π₯ Get Full Report ($99)", variant="primary", size="lg")
upgrade_output = gr.Markdown()
preview_btn.click(
fn=scan_domain_preview,
inputs=[preview_input],
outputs=[preview_output]
)
upgrade_btn.click(
fn=get_upgrade_link,
inputs=[preview_input],
outputs=[upgrade_output]
)
# TAB 3: About ACO
with gr.Tab("π About ACO"):
gr.Markdown("""
## What's Included in Your Benchmark
**A comprehensive 6-point analysis covering every aspect of agent commerce optimization**
### π What We Analyze
### π SEO Analysis
SSL, robots.txt, sitemap, meta tags, and traditional search optimization factors.
### π€ ACO Analysis
Agent card, MCP manifest, llms.txt, structured data, and AI agent discoverability.
### π Security Scan
Security headers, rate limiting, sybil protection, and human escalation paths.
### β
Consent Audit
GDPR, CCPA, and ACO consent compliance. Informed, voluntary, and fiduciary analysis.
### π§ CEH-RI Analysis
Cognitive Event Horizon Risk Index across 6 dimensions of agent decision-making.
### π Pathology Report
Perception asymmetry, epistemic ambiguity, trust exhaustion risk assessment.
---
## What You Get
β
Overall ACO Grade (A+ to F)
β
Detailed score breakdown
β
6-dimension CEH-RI analysis
β
Vulnerability detection
β
Compliance status (GDPR, CCPA, ACO)
β
Prioritized recommendations
β
Instant results (no waiting)
β
Downloadable PDF report
β
Compare against best practices
β
Actionable improvement steps
---
## ONE-TIME ANALYSIS: $99
Complete 6-point benchmark analysis with instant results:
- SEO + ACO + Security + Consent + CEH-RI + Pathology
- Prioritized action items
- PDF report download
- Results saved for future reference
- Secure payment via Stripe
---
### π Powered by SmartLedger
ACO Academy is built on the **SmartLedger ecosystem**:
- **EΒ² Identity** - Verifiable credentials for agent authentication
- **BLS Explorer** - Transparent blockchain audit trails
- **SNTNL Network** - Decentralized trust infrastructure
**[Learn more at agenticcommerce.academy β](https://agenticcommerce.academy)**
""")
gr.Markdown("""
---
**ACO Academy - The SEO of the AI Era** | [Run Full Benchmark ($99)](https://agenticcommerce.academy/benchmark) | Powered by [SmartLedger Solutions](https://smartledger.solutions)
""")
# Launch configuration for HuggingFace Docker Space
if __name__ == "__main__":
demo.launch(
server_name="0.0.0.0",
server_port=7860
)
|