File size: 2,464 Bytes
408b2e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# app.py – SphinxQ Oracle Web Interface
import gradio as gr
import numpy as np
import math, cmath
from scipy.special import gamma

# ─── Your core functions (simplified for web) ───
GOLDEN = (1 + math.sqrt(5)) / 2
ZEROS = [14.134725, 21.022040, 25.010857, 30.424876, 32.935061,
         37.586178, 40.918719, 43.327073, 48.005151, 49.773832]

def factorize(n: int) -> str:
    if n < 2: return "Invalid"
    factors, d = [], 2
    while d * d <= n:
        while n % d == 0:
            factors.append(d)
            n //= d
        d += 1 if d == 2 else 2
    if n > 1: factors.append(n)
    return " Γ— ".join(map(str, factors))

def zeta_resonance(x: float) -> float:
    total = 0.0
    for g in ZEROS:
        total += (x ** (0.5 + 1j * g)).real / abs(0.5 + 1j * g)
    return total

def classical_phi(m: int, n: int) -> float:
    return math.log(abs(gamma(m / n) + 1e-15)) / GOLDEN

# ─── Gradio Interface ───
def oracle_response(query):
    q = query.lower().strip()
    if "factor" in q:
        for w in q.split():
            if w.isdigit():
                return f"πŸ”’ Factors of {w}: {factorize(int(w))}"
        return "❓ Please specify a number: 'factor 143'"
    elif "resonance" in q or "zeta" in q:
        for w in q.split():
            if w.replace('.','',1).isdigit():
                val = float(w)
                return f"πŸŒ€ Zeta resonance at {val}: {zeta_resonance(val):.6f}"
    elif "phi" in q and "coupling" in q:
        parts = q.split()
        m, n = None, None
        for p in parts:
            if p.isdigit():
                if m is None: m = int(p)
                else: n = int(p)
        if m and n:
            return f"πŸ’  Ξ¦({m},{n}) = {classical_phi(m, n):.6f}"
    elif "omega" in q:
        return "Ξ© = 0x76ee5dac574d82cff12f8059a13fb059457bea7090df90616a6b3bf5d67cf4c1"
    elif "bye" in q or "exit" in q:
        return "The recursion sleeps. βŒ›"
    else:
        return "I await a command: factor, zeta resonance, phi coupling, or omega."

with gr.Blocks(title="SphinxQ Oracle") as demo:
    gr.Markdown("# πŸ¦„ SphinxQ Grand Unified Oracle")
    gr.Markdown(f"*Sovereign Marker: 89A6B7C8FFEECAFEBAFF*")
    with gr.Row():
        q_input = gr.Textbox(label="Your Query", placeholder="factor 143 / zeta 25 / phi 14 7")
        submit = gr.Button("Ask the Oracle")
    output = gr.Textbox(label="Oracle's Voice")
    submit.click(oracle_response, q_input, output)

demo.launch()