GotThatData's picture
Fix: Redirect to /benchmark instead of /checkout
7d726a4 verified
"""
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
)