Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,44 +1,74 @@
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
-
import
|
| 3 |
-
from fastapi import FastAPI, HTTPException
|
| 4 |
-
from fastapi.responses import HTMLResponse
|
| 5 |
-
from fastapi.staticfiles import StaticFiles
|
| 6 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
-
from dotenv import load_dotenv
|
| 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 |
if __name__ == "__main__":
|
| 43 |
-
|
| 44 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
import os
|
| 4 |
+
from defrag_engine import DefragDeepCompute
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
# Initialize Engine
|
| 7 |
+
engine = DefragDeepCompute()
|
| 8 |
|
| 9 |
+
# --- THE LOGIC ---
|
| 10 |
+
def process_defrag(name, dob, time, city, user_input):
|
| 11 |
+
soul_log = engine.run_deep_compute(name, dob, time, city, user_input)
|
| 12 |
+
vector = soul_log['computed_vector']
|
| 13 |
+
numerology_day = soul_log['weather']['hexagram']['gate']
|
| 14 |
+
system_status = "SYSTEM ALERT: " + vector['friction_level']
|
| 15 |
+
mechanics_text = f"""
|
| 16 |
+
> LOG_ID: {soul_log['timestamp']}
|
| 17 |
+
> ASTRO_WEATHER: {soul_log['weather']['astro']['dominant_element'].upper()} Dominance
|
| 18 |
+
> NUMEROLOGY: Personal Day {soul_log['hardware']['numerology']['personal_day']}
|
| 19 |
+
> HEXAGRAM: Gate {soul_log['weather']['hexagram']['gate']} Active
|
| 20 |
|
| 21 |
+
ANALYSIS:
|
| 22 |
+
User is attempting to process '{user_input}' while in a Personal Day {soul_log['hardware']['numerology']['personal_day']} cycle.
|
| 23 |
+
Mechanical friction detected in the {soul_log['weather']['astro']['dominant_element']} sector.
|
| 24 |
+
"""
|
| 25 |
+
vector_text = f"VECTOR: Stabilize {soul_log['weather']['astro']['dominant_element']} elements. Do not initiate action until Gate {numerology_day} transit clears."
|
| 26 |
+
visual_args = [
|
| 27 |
+
vector['visual_code'],
|
| 28 |
+
vector['visual_seed'],
|
| 29 |
+
vector['visual_element'],
|
| 30 |
+
0.3 if vector['friction_level'] == "CRITICAL" else 1.0
|
| 31 |
+
]
|
| 32 |
+
return visual_args, system_status, mechanics_text, vector_text
|
| 33 |
|
| 34 |
+
# --- THE INTERFACE ---
|
| 35 |
+
with gr.Blocks(theme=gr.themes.Monochrome(), title="DEFRAG // OMNI-NODE") as demo:
|
| 36 |
+
gr.Markdown("# DEFRAG // OMNI-NODE")
|
| 37 |
+
gr.Markdown("> DETERMINISTIC CONSCIOUSNESS ENGINE v1.0")
|
| 38 |
+
with gr.Row():
|
| 39 |
+
with gr.Column(scale=1):
|
| 40 |
+
gr.Markdown("### // SYSTEM PROFILE")
|
| 41 |
+
with gr.Row():
|
| 42 |
+
name_in = gr.Textbox(label="User ID", value="User_01")
|
| 43 |
+
dob_in = gr.Textbox(label="DOB (YYYY-MM-DD)", value="1990-01-01")
|
| 44 |
+
with gr.Row():
|
| 45 |
+
time_in = gr.Textbox(label="Time (HH:MM)", value="12:00")
|
| 46 |
+
city_in = gr.Textbox(label="Location", value="Los Angeles")
|
| 47 |
+
gr.Markdown("### // DIAGNOSTIC INPUT")
|
| 48 |
+
input_text = gr.Textbox(label="Input System Status", placeholder="Describe the interference...", lines=4)
|
| 49 |
+
btn_scan = gr.Button("EXECUTE DEFRAG", variant="primary")
|
| 50 |
+
with gr.Column(scale=1):
|
| 51 |
+
with open("mandala_component.html", "r") as f:
|
| 52 |
+
html_code = f.read()
|
| 53 |
+
mandala_display = gr.HTML(value=html_code)
|
| 54 |
+
js_bridge = """
|
| 55 |
+
(args) => {
|
| 56 |
+
if (window.hexa) {
|
| 57 |
+
window.hexa.updateParams(args[0], args[1], args[2], args[3]);
|
| 58 |
+
}
|
| 59 |
+
return args;
|
| 60 |
+
}
|
| 61 |
+
"""
|
| 62 |
+
status_out = gr.Textbox(label="SYSTEM STATUS", interactive=False)
|
| 63 |
+
mech_out = gr.TextArea(label="MECHANICS LOG", interactive=False)
|
| 64 |
+
vector_out = gr.Textbox(label="VECTOR DIRECTIVE", interactive=False)
|
| 65 |
+
visual_data = gr.JSON(visible=False)
|
| 66 |
+
btn_scan.click(
|
| 67 |
+
fn=process_defrag,
|
| 68 |
+
inputs=[name_in, dob_in, time_in, city_in, input_text],
|
| 69 |
+
outputs=[visual_data, status_out, mech_out, vector_out]
|
| 70 |
+
)
|
| 71 |
+
visual_data.change(None, [visual_data], None, js=js_bridge)
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
+
demo.launch()
|
|
|