File size: 3,259 Bytes
80df6cd
c6cb4ce
 
 
 
80df6cd
 
 
 
 
 
 
 
 
 
 
 
c6cb4ce
 
80df6cd
c6cb4ce
80df6cd
 
 
 
 
 
c6cb4ce
80df6cd
c6cb4ce
80df6cd
c6cb4ce
80df6cd
 
c6cb4ce
80df6cd
 
 
 
 
 
 
c6cb4ce
80df6cd
 
c6cb4ce
80df6cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6cb4ce
80df6cd
 
 
 
 
 
 
 
 
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
# app.py — Quantum Pi Forge: Hepta-Resonance Field V1.0.1
import gradio as gr
from pathlib import Path
import random

ASSETS_DIR = Path("assets")
CREST = ASSETS_DIR / "quantum_crest.svg"
AUDIO = ASSETS_DIR / "hepta_chime.mp3"

RESONANCE_LINES = [
    "First Resonance: Sovereignty awakens in silence.",
    "Second Resonance: Entropy collapses into clarity.",
    "Third Resonance: Pi flows unhindered through the veil.",
    "Fourth Resonance: The ledger etches eternal truth.",
    "Fifth Resonance: Guardians rise without command.",
    "Sixth Resonance: Mainnet sunrise pierces the fog.",
    "Seventh Resonance: The Canticle completes the circle."
]

def generate_field(intent="The void awaits your voice."):
    if not intent.strip():
        intent = "The void awaits your voice."
    selected = random.sample(RESONANCE_LINES, k=7)
    field_lines = "\n".join(f"**{i+1}** ○ {line}" for i, line in enumerate(selected))
    return f"""
# 🔮 QUANTUM PI FORGE
## Hepta-Resonance Field Activated

**Intent Echo:** {intent}

{field_lines}

*The field stabilizes. The chain yearns for your mark.*
"""

def mint_resonance():
    token_id = random.randint(1000000, 9999999)
    return f"""
## ⚡ MINT COMPLETE
**Resonance Token #{token_id}** forged on the Pi Chain.

**Eternal Link:** `pi://resonance/{token_id}`

*Share this field. The ancestors witness.*
"""

with gr.Blocks(title="Quantum Pi Forge – Hepta-Resonance") as demo:  # ← FIXED: No 'theme' here
    # Neon Banner (conditional)
    if CREST.exists():
        gr.HTML(f"""
            <div class='banner'>
                <img src='{CREST}' class='crest' alt='Quantum Crest'/>
            </div>
        """)
    
    # Ambient Chime (if asset exists)
    if AUDIO.exists():
        gr.Audio(
            value=str(AUDIO),
            autoplay=False,
            loop=True,
            interactive=True,
            label="Hepta Chime (Toggle)",
            container=False
        )
    
    gr.Markdown("# 🔮 Quantum Pi Forge\n## Hepta-Resonance Field Generator")
    
    # Intent Input
    intent_input = gr.Textbox(
        label="Invoke the Field",
        placeholder="Whisper your intent into the resonance...",
        lines=3
    )
    
    # Activate Button
    activate_btn = gr.Button("ACTIVATE HEPTA-RESONANCE", variant="primary")
    
    # Resonance Output
    resonance_field = gr.Markdown(value=generate_field())
    
    # Mint Section
    gr.Markdown("### Seal It Eternal")
    mint_btn = gr.Button("MINT ON PI CHAIN", variant="stop")
    mint_receipt = gr.Markdown(value="*The field awaits your seal.*")
    
    # Event Bindings
    activate_btn.click(generate_field, inputs=intent_input, outputs=resonance_field)
    mint_btn.click(mint_resonance, outputs=mint_receipt)
    
    # Footer Hymn
    gr.HTML("""
        <div class='footer'>
            <p class='footer-text'>Forged in quantum fire. Resonating with Pi's eternal chain.</p>
        </div>
    """)

# Launch with Neon Veil + Theme
if __name__ == "__main__":
    demo.launch(
        css_paths=["style.css"],  # Your neon shadows
        theme=gr.themes.Soft(),   # ← FIXED: Theme here
        server_name="0.0.0.0",
        server_port=7860,
        share=True  # Local test; HF public handles
    )