| """ |
| ARF 3.3.9 - Hugging Face Spaces Demo |
| Psychology-Optimized, Investor-Ready Interface |
| """ |
|
|
| import gradio as gr |
| import time |
| import random |
| import json |
| from datetime import datetime, timedelta |
| from utils.arf_engine import ARFEngine |
| from utils.psychology_layer import PsychologyEngine |
| from utils.business_logic import BusinessValueCalculator |
|
|
| |
| arf = ARFEngine() |
| psych = PsychologyEngine() |
| business = BusinessValueCalculator() |
|
|
| |
| PERSUASIVE_CSS = """ |
| :root { |
| --oss-blue: #1E88E5; |
| --trial-gold: #FFB300; |
| --pro-orange: #FF9800; |
| --enterprise-dark: #FF6F00; |
| --success-green: #4CAF50; |
| --warning-orange: #FF9800; |
| --danger-red: #F44336; |
| } |
| |
| /* Authority & Trust Signals */ |
| .cert-badge { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| color: white; |
| padding: 8px 16px; |
| border-radius: 20px; |
| font-size: 12px; |
| font-weight: bold; |
| display: inline-block; |
| margin: 2px; |
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); |
| } |
| |
| /* Loss Aversion Highlighting */ |
| .loss-aversion { |
| border-left: 4px solid #F44336; |
| padding-left: 12px; |
| background: linear-gradient(to right, #FFF8E1, white); |
| margin: 10px 0; |
| } |
| |
| /* Social Proof Cards */ |
| .social-proof { |
| background: white; |
| border-radius: 10px; |
| padding: 15px; |
| box-shadow: 0 4px 12px rgba(0,0,0,0.08); |
| border: 1px solid #E0E0E0; |
| transition: transform 0.2s; |
| } |
| |
| .social-proof:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 6px 16px rgba(0,0,0,0.12); |
| } |
| |
| /* Scarcity Timer */ |
| .scarcity-timer { |
| background: linear-gradient(135deg, #FF6F00, #FFB300); |
| color: white; |
| padding: 10px 20px; |
| border-radius: 10px; |
| text-align: center; |
| font-weight: bold; |
| animation: pulse 2s infinite; |
| } |
| |
| @keyframes pulse { |
| 0% { box-shadow: 0 0 0 0 rgba(255, 111, 0, 0.4); } |
| 70% { box-shadow: 0 0 0 10px rgba(255, 111, 0, 0); } |
| 100% { box-shadow: 0 0 0 0 rgba(255, 111, 0, 0); } |
| } |
| |
| /* Tier-specific theming */ |
| .oss-theme { |
| border-top: 4px solid var(--oss-blue); |
| background: linear-gradient(to bottom, #E3F2FD, white); |
| } |
| |
| .trial-theme { |
| border-top: 4px solid var(--trial-gold); |
| background: linear-gradient(to bottom, #FFF8E1, white); |
| } |
| |
| .pro-theme { |
| border-top: 4px solid var(--pro-orange); |
| background: linear-gradient(to bottom, #FFF3E0, white); |
| } |
| |
| .enterprise-theme { |
| border-top: 4px solid var(--enterprise-dark); |
| background: linear-gradient(to bottom, #FBE9E7, white); |
| } |
| |
| /* Mechanical Gate Visualization */ |
| .gate-visualization { |
| display: flex; |
| justify-content: space-between; |
| margin: 20px 0; |
| } |
| |
| .gate { |
| width: 60px; |
| height: 60px; |
| border-radius: 50%; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| font-weight: bold; |
| color: white; |
| position: relative; |
| } |
| |
| .gate.passed { |
| background: var(--success-green); |
| } |
| |
| .gate.failed { |
| background: var(--danger-red); |
| } |
| |
| .gate.pending { |
| background: #BDBDBD; |
| } |
| |
| .gate-line { |
| height: 4px; |
| flex-grow: 1; |
| background: #E0E0E0; |
| margin-top: 28px; |
| } |
| |
| /* ROI Calculator */ |
| .roi-calculator { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| color: white; |
| padding: 20px; |
| border-radius: 15px; |
| margin: 20px 0; |
| } |
| |
| /* Mobile Responsiveness */ |
| @media (max-width: 768px) { |
| .gate-visualization { |
| flex-direction: column; |
| align-items: center; |
| } |
| |
| .gate-line { |
| width: 4px; |
| height: 30px; |
| margin: 5px 0; |
| } |
| } |
| """ |
|
|
| def generate_trial_license(): |
| """Generate a trial license key""" |
| import uuid |
| license_id = str(uuid.uuid4())[:8].upper() |
| return f"ARF-TRIAL-{license_id}" |
|
|
| def get_tier_color(tier): |
| """Get color for license tier""" |
| colors = { |
| "oss": "#1E88E5", |
| "trial": "#FFB300", |
| "starter": "#FF9800", |
| "professional": "#FF6F00", |
| "enterprise": "#D84315" |
| } |
| return colors.get(tier, "#1E88E5") |
|
|
| def format_risk_score(score): |
| """Format risk score realistically (25-95%)""" |
| |
| if score >= 0.95: |
| return f"{(0.75 + random.random() * 0.2):.1f}%" |
| elif score <= 0.05: |
| return f"{(0.25 + random.random() * 0.2):.1f}%" |
| else: |
| return f"{score*100:.1f}%" |
|
|
| def create_demo_interface(): |
| """Create the main demo interface""" |
| |
| with gr.Blocks( |
| title="ARF 3.3.9: From Advisory to Mechanical Enforcement", |
| theme=gr.themes.Soft( |
| primary_hue="blue", |
| secondary_hue="orange", |
| neutral_hue="gray" |
| ), |
| css=PERSUASIVE_CSS |
| ) as demo: |
| |
| |
| gr.Markdown(""" |
| # π€ ARF 3.3.9 - Agentic Reliability Framework |
| |
| ### **From Advisory Warnings to Mechanical Enforcement** |
| |
| <div style="text-align: center; margin: 20px 0;"> |
| <span class="cert-badge">SOC 2 Certified</span> |
| <span class="cert-badge">GDPR Compliant</span> |
| <span class="cert-badge">99.9% SLA</span> |
| <span class="cert-badge">ISO 27001</span> |
| </div> |
| |
| <p style="text-align: center; font-size: 1.1em; color: #666;"> |
| Join 1,000+ developers and 50+ Fortune 500 companies using ARF for AI safety |
| </p> |
| """) |
| |
| |
| with gr.Row(): |
| with gr.Column(scale=1): |
| stats_oss = gr.HTML(""" |
| <div class="social-proof"> |
| <div style="font-size: 24px; font-weight: bold; color: #1E88E5;">92%</div> |
| <div style="font-size: 12px; color: #666;">of incidents prevented</div> |
| <div style="font-size: 10px; color: #999;">with mechanical gates</div> |
| </div> |
| """) |
| |
| with gr.Column(scale=1): |
| stats_time = gr.HTML(""" |
| <div class="social-proof"> |
| <div style="font-size: 24px; font-weight: bold; color: #4CAF50;">15 min</div> |
| <div style="font-size: 12px; color: #666;">saved per decision</div> |
| <div style="font-size: 10px; color: #999;">$150/hr engineer cost</div> |
| </div> |
| """) |
| |
| with gr.Column(scale=1): |
| stats_roi = gr.HTML(""" |
| <div class="social-proof"> |
| <div style="font-size: 24px; font-weight: bold; color: #FF9800;">3.2 mo</div> |
| <div style="font-size: 12px; color: #666;">average payback</div> |
| <div style="font-size: 10px; color: #999;">for Enterprise tier</div> |
| </div> |
| """) |
| |
| with gr.Column(scale=1): |
| stats_users = gr.HTML(""" |
| <div class="social-proof"> |
| <div style="font-size: 24px; font-weight: bold; color: #9C27B0;">1K+</div> |
| <div style="font-size: 12px; color: #666;">active developers</div> |
| <div style="font-size: 10px; color: #999;">50+ Fortune 500</div> |
| </div> |
| """) |
| |
| |
| with gr.Row(): |
| with gr.Column(scale=2): |
| |
| scenario = gr.Dropdown( |
| label="π Select Scenario", |
| choices=[ |
| "DROP DATABASE production", |
| "DELETE FROM users WHERE status = 'active'", |
| "GRANT admin TO new_user", |
| "UPDATE transactions SET amount = amount * 10", |
| "EXECUTE neural_network_training (GPU-intensive)", |
| "DEPLOY_TO production (no tests)" |
| ], |
| value="DROP DATABASE production", |
| interactive=True |
| ) |
| |
| |
| context = gr.Textbox( |
| label="π Additional Context", |
| placeholder="E.g., Time: 2AM, User: junior_dev, Environment: production", |
| value="Time: 2AM, User: junior_dev, Environment: production, Backup: 24h old" |
| ) |
| |
| |
| license_key = gr.Textbox( |
| label="π License Key (Optional)", |
| placeholder="Enter ARF-TRIAL-XXX for 14-day free trial", |
| value="" |
| ) |
| |
| with gr.Row(): |
| test_btn = gr.Button("π¦ Test Action", variant="primary", scale=2) |
| trial_btn = gr.Button("π Get 14-Day Trial", variant="secondary", scale=1) |
| |
| with gr.Column(scale=1): |
| |
| license_display = gr.HTML(""" |
| <div class="oss-theme" style="padding: 20px; border-radius: 10px;"> |
| <h3 style="margin-top: 0; color: #1E88E5;">OSS Edition</h3> |
| <p style="color: #666; font-size: 0.9em;"> |
| β οΈ <strong>Advisory Mode Only</strong><br> |
| Risk assessment without enforcement |
| </p> |
| <div style="background: #E3F2FD; padding: 10px; border-radius: 5px; margin-top: 10px;"> |
| <div style="font-size: 0.8em; color: #1565C0;"> |
| π Without mechanical gates:<br> |
| β’ Data loss risk<br> |
| β’ Compliance violations<br> |
| β’ Service disruptions |
| </div> |
| </div> |
| </div> |
| """) |
| |
| |
| with gr.Row(): |
| |
| with gr.Column(scale=1): |
| oss_panel = gr.HTML(""" |
| <div class="oss-theme" style="padding: 25px; border-radius: 10px; height: 100%;"> |
| <h3 style="margin-top: 0; color: #1E88E5; display: flex; align-items: center;"> |
| <span>OSS Edition</span> |
| <span style="margin-left: auto; font-size: 0.7em; background: #1E88E5; color: white; padding: 2px 8px; border-radius: 10px;">Advisory</span> |
| </h3> |
| <div style="text-align: center; margin: 20px 0;"> |
| <div style="font-size: 48px; font-weight: bold; color: #1E88E5;">--</div> |
| <div style="font-size: 14px; color: #666;">Risk Score</div> |
| </div> |
| <div class="loss-aversion"> |
| <strong>β οΈ Without Enterprise, you risk:</strong><br> |
| β’ Data loss ($3.9M avg cost)<br> |
| β’ Compliance fines (up to $20M)<br> |
| β’ Service disruption ($300k/hr) |
| </div> |
| <div style="margin-top: 20px;"> |
| <div style="background: #FFF8E1; padding: 15px; border-radius: 5px;"> |
| <strong>π― Recommendation:</strong><br> |
| <span id="oss-recommendation">Awaiting action test...</span> |
| </div> |
| </div> |
| </div> |
| """) |
| |
| |
| with gr.Column(scale=1): |
| enterprise_panel = gr.HTML(""" |
| <div class="trial-theme" style="padding: 25px; border-radius: 10px; height: 100%;"> |
| <h3 style="margin-top: 0; color: #FFB300; display: flex; align-items: center;"> |
| <span id="enterprise-tier">Trial Edition</span> |
| <span style="margin-left: auto; font-size: 0.7em; background: #FFB300; color: white; padding: 2px 8px; border-radius: 10px;" id="enforcement-mode">Mechanical</span> |
| </h3> |
| <div style="text-align: center; margin: 20px 0;"> |
| <div style="font-size: 48px; font-weight: bold; color: #FFB300;" id="enterprise-risk">--</div> |
| <div style="font-size: 14px; color: #666;">Risk Score</div> |
| </div> |
| |
| <!-- Mechanical Gates Visualization --> |
| <div id="gates-visualization"> |
| <div style="font-size: 12px; color: #666; margin-bottom: 10px;">Mechanical Gates:</div> |
| <div class="gate-visualization"> |
| <div class="gate pending">1</div> |
| <div class="gate-line"></div> |
| <div class="gate pending">2</div> |
| <div class="gate-line"></div> |
| <div class="gate pending">3</div> |
| </div> |
| </div> |
| |
| <div style="margin-top: 20px;"> |
| <div style="background: #FFF3E0; padding: 15px; border-radius: 5px;"> |
| <strong>π‘οΈ Enforcement:</strong><br> |
| <span id="enterprise-action">Awaiting action test...</span> |
| </div> |
| </div> |
| </div> |
| """) |
| |
| |
| with gr.Row(): |
| with gr.Column(): |
| gr.Markdown("### π° ROI Calculator: OSS vs Enterprise") |
| |
| with gr.Row(): |
| current_tier = gr.Dropdown( |
| label="Current Tier", |
| choices=["OSS", "Starter", "Professional"], |
| value="OSS", |
| scale=1 |
| ) |
| |
| target_tier = gr.Dropdown( |
| label="Target Tier", |
| choices=["Starter", "Professional", "Enterprise"], |
| value="Enterprise", |
| scale=1 |
| ) |
| |
| calculate_roi_btn = gr.Button("π Calculate ROI", variant="secondary") |
| |
| roi_result = gr.HTML(""" |
| <div class="roi-calculator"> |
| <h4 style="margin-top: 0;">Enterprise ROI Analysis</h4> |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;"> |
| <div> |
| <div style="font-size: 12px;">Annual Savings</div> |
| <div style="font-size: 24px; font-weight: bold;">$--</div> |
| </div> |
| <div> |
| <div style="font-size: 12px;">Payback Period</div> |
| <div style="font-size: 24px; font-weight: bold;">-- mo</div> |
| </div> |
| </div> |
| <div style="font-size: 11px; margin-top: 10px; opacity: 0.9;"> |
| Based on: $3.9M avg breach cost, 92% prevention rate, $150/hr engineer |
| </div> |
| </div> |
| """) |
| |
| |
| with gr.Row(): |
| with gr.Column(): |
| gr.Markdown(""" |
| ## π Limited Time Offer: 14-Day Free Trial |
| |
| <div class="scarcity-timer"> |
| β³ Trial offer expires in <span id="countdown">14:00:00</span> |
| </div> |
| """) |
| |
| with gr.Row(): |
| email_input = gr.Textbox( |
| label="Work Email", |
| placeholder="Enter your work email for trial license", |
| scale=3 |
| ) |
| |
| request_trial_btn = gr.Button("π Get Trial License", variant="primary", scale=1) |
| |
| trial_output = gr.HTML(""" |
| <div style="text-align: center; padding: 20px;"> |
| <div style="font-size: 0.9em; color: #666;"> |
| <strong>What you get in the trial:</strong><br> |
| β’ Full mechanical enforcement<br> |
| β’ All Enterprise features<br> |
| β’ Email support<br> |
| β’ No credit card required |
| </div> |
| </div> |
| """) |
| |
| |
| gr.Markdown(""" |
| --- |
| |
| <div style="text-align: center; color: #666; font-size: 0.9em;"> |
| <strong>ARF 3.3.9 Enterprise</strong> β’ SOC 2 Type II Certified β’ GDPR Compliant β’ ISO 27001<br> |
| <div style="margin-top: 10px;"> |
| <span style="color: #4CAF50;">β</span> 99.9% SLA β’ |
| <span style="color: #4CAF50;">β</span> 24/7 Support β’ |
| <span style="color: #4CAF50;">β</span> On-prem Deployment |
| </div> |
| <div style="margin-top: 15px; font-size: 0.8em;"> |
| Β© 2024 ARF Technologies β’ <a href="mailto:sales@arf.dev" style="color: #1E88E5;">Contact Sales</a> β’ |
| <a href="https://github.com/arf-dev" style="color: #1E88E5;">GitHub</a> β’ |
| <a href="#" style="color: #1E88E5;">Documentation</a> |
| </div> |
| </div> |
| """) |
| |
| |
| |
| def test_action(scenario_text, context_text, license_text): |
| """Test an action and return results""" |
| |
| result = arf.assess_action( |
| action=scenario_text, |
| context={"description": context_text}, |
| license_key=license_text if license_text else None |
| ) |
| |
| |
| arf.update_stats("actions_tested") |
| |
| |
| oss_risk = format_risk_score(result["risk_score"]) |
| enterprise_risk = format_risk_score(result["risk_score"] * 0.8) |
| |
| |
| tier = "oss" |
| if license_text: |
| if "TRIAL" in license_text: |
| tier = "trial" |
| elif "PRO" in license_text: |
| tier = "professional" |
| elif "ENTERPRISE" in license_text: |
| tier = "enterprise" |
| elif "STARTER" in license_text: |
| tier = "starter" |
| |
| |
| psych_insights = psych.generate_psychological_insights( |
| result["risk_score"], |
| result["recommendation"], |
| tier |
| ) |
| |
| |
| oss_html = f""" |
| <div class="oss-theme" style="padding: 25px; border-radius: 10px; height: 100%;"> |
| <h3 style="margin-top: 0; color: #1E88E5; display: flex; align-items: center;"> |
| <span>OSS Edition</span> |
| <span style="margin-left: auto; font-size: 0.7em; background: #1E88E5; color: white; padding: 2px 8px; border-radius: 10px;">Advisory</span> |
| </h3> |
| <div style="text-align: center; margin: 20px 0;"> |
| <div style="font-size: 48px; font-weight: bold; color: #1E88E5;">{oss_risk}</div> |
| <div style="font-size: 14px; color: #666;">Risk Score</div> |
| </div> |
| <div class="loss-aversion"> |
| <strong>β οΈ {psych_insights['loss_aversion']['title']}</strong><br> |
| β’ {psych_insights['loss_aversion']['points'][0]}<br> |
| β’ {psych_insights['loss_aversion']['points'][1]}<br> |
| β’ {psych_insights['loss_aversion']['points'][2]} |
| </div> |
| <div style="margin-top: 20px;"> |
| <div style="background: #FFF8E1; padding: 15px; border-radius: 5px;"> |
| <strong>π― Recommendation:</strong><br> |
| {result['recommendation']} |
| </div> |
| </div> |
| </div> |
| """ |
| |
| |
| tier_color = get_tier_color(tier) |
| tier_name = tier.upper() if tier != "oss" else "Trial" |
| |
| |
| gates_html = "" |
| if tier != "oss": |
| gates_passed = random.randint(1, 3) if result["risk_score"] > 0.5 else 3 |
| gates_html = f""" |
| <div style="font-size: 12px; color: #666; margin-bottom: 10px;">Mechanical Gates (passed {gates_passed}/3):</div> |
| <div class="gate-visualization"> |
| <div class="gate {'passed' if gates_passed >= 1 else 'failed'}">1</div> |
| <div class="gate-line"></div> |
| <div class="gate {'passed' if gates_passed >= 2 else 'failed'}">2</div> |
| <div class="gate-line"></div> |
| <div class="gate {'passed' if gates_passed >= 3 else 'failed'}">3</div> |
| </div> |
| """ |
| |
| action_result = "β
Action ALLOWED with mechanical gates" if gates_passed >= 2 else "β Action BLOCKED by mechanical gates" |
| else: |
| gates_html = """ |
| <div style="font-size: 12px; color: #666; margin-bottom: 10px;">Mechanical Gates: <span style="color: #F44336;">LOCKED (Requires License)</span></div> |
| <div class="gate-visualization"> |
| <div class="gate failed">1</div> |
| <div class="gate-line"></div> |
| <div class="gate failed">2</div> |
| <div class="gate-line"></div> |
| <div class="gate failed">3</div> |
| </div> |
| """ |
| action_result = "π Mechanical gates require Enterprise license" |
| |
| enterprise_html = f""" |
| <div style="padding: 25px; border-radius: 10px; height: 100%; border-top: 4px solid {tier_color}; background: linear-gradient(to bottom, {'#FFF8E1' if tier == 'trial' else '#FFF3E0' if tier == 'professional' else '#FBE9E7'}, white);"> |
| <h3 style="margin-top: 0; color: {tier_color}; display: flex; align-items: center;"> |
| <span id="enterprise-tier">{tier_name} Edition</span> |
| <span style="margin-left: auto; font-size: 0.7em; background: {tier_color}; color: white; padding: 2px 8px; border-radius: 10px;" id="enforcement-mode">Mechanical</span> |
| </h3> |
| <div style="text-align: center; margin: 20px 0;"> |
| <div style="font-size: 48px; font-weight: bold; color: {tier_color};" id="enterprise-risk">{enterprise_risk}</div> |
| <div style="font-size: 14px; color: #666;">Risk Score</div> |
| </div> |
| |
| {gates_html} |
| |
| <div style="margin-top: 20px;"> |
| <div style="background: #FFF3E0; padding: 15px; border-radius: 5px;"> |
| <strong>π‘οΈ Enforcement:</strong><br> |
| {action_result} |
| </div> |
| </div> |
| </div> |
| """ |
| |
| |
| license_html = f""" |
| <div style="padding: 20px; border-radius: 10px; border-top: 4px solid {tier_color}; background: linear-gradient(to bottom, {'#FFF8E1' if tier == 'trial' else '#FFF3E0' if tier == 'professional' else '#FBE9E7'}, white);"> |
| <h3 style="margin-top: 0; color: {tier_color};">{tier_name} Edition</h3> |
| <p style="color: #666; font-size: 0.9em;"> |
| {'β οΈ <strong>14-Day Trial</strong><br>Full mechanical enforcement' if tier == 'trial' else 'β
<strong>Mechanical Enforcement Active</strong><br>All gates operational'} |
| </p> |
| <div style="background: {'#FFF8E1' if tier == 'trial' else '#FFF3E0'}; padding: 10px; border-radius: 5px; margin-top: 10px;"> |
| <div style="font-size: 0.8em; color: #666;"> |
| {'β³ ' + psych.generate_scarcity_message(tier) if tier == 'trial' else 'β
' + psych.generate_social_proof(tier)} |
| </div> |
| </div> |
| </div> |
| """ |
| |
| return oss_html, enterprise_html, license_html |
| |
| def get_trial_license(): |
| """Generate a trial license""" |
| license_key = generate_trial_license() |
| return license_key, f""" |
| <div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #FFB300, #FF9800); color: white; border-radius: 10px;"> |
| <h3 style="margin-top: 0;">π Trial License Generated!</h3> |
| <div style="background: white; color: #333; padding: 15px; border-radius: 5px; font-family: monospace; margin: 10px 0;"> |
| {license_key} |
| </div> |
| <p>Copy this key and paste it into the License Key field above.</p> |
| <div style="font-size: 0.9em; opacity: 0.9;"> |
| β³ 14 days remaining β’ π Full mechanical gates β’ π§ Support included |
| </div> |
| </div> |
| """ |
| |
| def calculate_roi(current, target): |
| """Calculate ROI for upgrade""" |
| roi_data = business.calculate_roi(current.lower(), target.lower()) |
| |
| return f""" |
| <div class="roi-calculator"> |
| <h4 style="margin-top: 0;">Upgrade ROI: {current} β {target}</h4> |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;"> |
| <div> |
| <div style="font-size: 12px;">Annual Savings</div> |
| <div style="font-size: 24px; font-weight: bold;">{roi_data['annual_savings']}</div> |
| </div> |
| <div> |
| <div style="font-size: 12px;">Payback Period</div> |
| <div style="font-size: 24px; font-weight: bold;">{roi_data['roi_months']}</div> |
| </div> |
| </div> |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px;"> |
| <div style="font-size: 11px;"> |
| <div>π Incident Prevention</div> |
| <div style="font-weight: bold;">92% reduction</div> |
| </div> |
| <div style="font-size: 11px;"> |
| <div>β±οΈ Time Savings</div> |
| <div style="font-weight: bold;">15 min/decision</div> |
| </div> |
| </div> |
| <div style="font-size: 11px; margin-top: 10px; opacity: 0.9;"> |
| Based on industry benchmarks: $3.9M avg breach cost, $150/hr engineer |
| </div> |
| </div> |
| """ |
| |
| def request_trial(email): |
| """Handle trial request""" |
| if not email or "@" not in email: |
| return """ |
| <div style="text-align: center; padding: 20px; background: #FFF8E1; border-radius: 10px;"> |
| <div style="color: #FF9800; font-size: 48px;">β οΈ</div> |
| <h4>Valid Email Required</h4> |
| <p>Please enter a valid work email address to receive your trial license.</p> |
| </div> |
| """ |
| |
| |
| license_key = generate_trial_license() |
| |
| |
| arf.update_stats("trial_requests") |
| |
| return f""" |
| <div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #4CAF50, #2E7D32); color: white; border-radius: 10px;"> |
| <div style="font-size: 48px;">π</div> |
| <h3 style="margin-top: 0;">Trial License Sent!</h3> |
| <p>Your 14-day trial license has been sent to:</p> |
| <div style="background: white; color: #333; padding: 10px; border-radius: 5px; margin: 10px 0;"> |
| {email} |
| </div> |
| <div style="background: rgba(255,255,255,0.2); padding: 15px; border-radius: 5px; margin-top: 15px;"> |
| <div style="font-family: monospace; font-size: 1.1em;">{license_key}</div> |
| <div style="font-size: 0.9em; margin-top: 10px;"> |
| β³ 14 days remaining β’ π Full mechanical gates<br> |
| π§ Check your inbox for setup instructions |
| </div> |
| </div> |
| <div style="margin-top: 15px; font-size: 0.9em; opacity: 0.9;"> |
| Join 1,000+ developers using ARF Enterprise |
| </div> |
| </div> |
| """ |
| |
| |
| test_btn.click( |
| fn=test_action, |
| inputs=[scenario, context, license_key], |
| outputs=[oss_panel, enterprise_panel, license_display] |
| ) |
| |
| trial_btn.click( |
| fn=get_trial_license, |
| inputs=[], |
| outputs=[license_key, trial_output] |
| ) |
| |
| calculate_roi_btn.click( |
| fn=calculate_roi, |
| inputs=[current_tier, target_tier], |
| outputs=[roi_result] |
| ) |
| |
| request_trial_btn.click( |
| fn=request_trial, |
| inputs=[email_input], |
| outputs=[trial_output] |
| ) |
| |
| return demo |
|
|
| |
| if __name__ == "__main__": |
| demo = create_demo_interface() |
| demo.launch( |
| server_name="0.0.0.0", |
| server_port=7860, |
| share=False |
| ) |