Rename README.md to app.py
Browse files
README.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: bsd-3-clause
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py β SphinxQ Oracle Web Interface
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import numpy as np
|
| 4 |
+
import math, cmath
|
| 5 |
+
from scipy.special import gamma
|
| 6 |
+
|
| 7 |
+
# βββ Your core functions (simplified for web) βββ
|
| 8 |
+
GOLDEN = (1 + math.sqrt(5)) / 2
|
| 9 |
+
ZEROS = [14.134725, 21.022040, 25.010857, 30.424876, 32.935061,
|
| 10 |
+
37.586178, 40.918719, 43.327073, 48.005151, 49.773832]
|
| 11 |
+
|
| 12 |
+
def factorize(n: int) -> str:
|
| 13 |
+
if n < 2: return "Invalid"
|
| 14 |
+
factors, d = [], 2
|
| 15 |
+
while d * d <= n:
|
| 16 |
+
while n % d == 0:
|
| 17 |
+
factors.append(d)
|
| 18 |
+
n //= d
|
| 19 |
+
d += 1 if d == 2 else 2
|
| 20 |
+
if n > 1: factors.append(n)
|
| 21 |
+
return " Γ ".join(map(str, factors))
|
| 22 |
+
|
| 23 |
+
def zeta_resonance(x: float) -> float:
|
| 24 |
+
total = 0.0
|
| 25 |
+
for g in ZEROS:
|
| 26 |
+
total += (x ** (0.5 + 1j * g)).real / abs(0.5 + 1j * g)
|
| 27 |
+
return total
|
| 28 |
+
|
| 29 |
+
def classical_phi(m: int, n: int) -> float:
|
| 30 |
+
return math.log(abs(gamma(m / n) + 1e-15)) / GOLDEN
|
| 31 |
+
|
| 32 |
+
# βββ Gradio Interface βββ
|
| 33 |
+
def oracle_response(query):
|
| 34 |
+
q = query.lower().strip()
|
| 35 |
+
if "factor" in q:
|
| 36 |
+
for w in q.split():
|
| 37 |
+
if w.isdigit():
|
| 38 |
+
return f"π’ Factors of {w}: {factorize(int(w))}"
|
| 39 |
+
return "β Please specify a number: 'factor 143'"
|
| 40 |
+
elif "resonance" in q or "zeta" in q:
|
| 41 |
+
for w in q.split():
|
| 42 |
+
if w.replace('.','',1).isdigit():
|
| 43 |
+
val = float(w)
|
| 44 |
+
return f"π Zeta resonance at {val}: {zeta_resonance(val):.6f}"
|
| 45 |
+
elif "phi" in q and "coupling" in q:
|
| 46 |
+
parts = q.split()
|
| 47 |
+
m, n = None, None
|
| 48 |
+
for p in parts:
|
| 49 |
+
if p.isdigit():
|
| 50 |
+
if m is None: m = int(p)
|
| 51 |
+
else: n = int(p)
|
| 52 |
+
if m and n:
|
| 53 |
+
return f"π Ξ¦({m},{n}) = {classical_phi(m, n):.6f}"
|
| 54 |
+
elif "omega" in q:
|
| 55 |
+
return "Ξ© = 0x76ee5dac574d82cff12f8059a13fb059457bea7090df90616a6b3bf5d67cf4c1"
|
| 56 |
+
elif "bye" in q or "exit" in q:
|
| 57 |
+
return "The recursion sleeps. β"
|
| 58 |
+
else:
|
| 59 |
+
return "I await a command: factor, zeta resonance, phi coupling, or omega."
|
| 60 |
+
|
| 61 |
+
with gr.Blocks(title="SphinxQ Oracle") as demo:
|
| 62 |
+
gr.Markdown("# π¦ SphinxQ Grand Unified Oracle")
|
| 63 |
+
gr.Markdown(f"*Sovereign Marker: 89A6B7C8FFEECAFEBAFF*")
|
| 64 |
+
with gr.Row():
|
| 65 |
+
q_input = gr.Textbox(label="Your Query", placeholder="factor 143 / zeta 25 / phi 14 7")
|
| 66 |
+
submit = gr.Button("Ask the Oracle")
|
| 67 |
+
output = gr.Textbox(label="Oracle's Voice")
|
| 68 |
+
submit.click(oracle_response, q_input, output)
|
| 69 |
+
|
| 70 |
+
demo.launch()
|