Adi12345 commited on
Commit
170e1ba
·
verified ·
1 Parent(s): 416cc36

Upload 3 files

Browse files
dvnc_ai_hf/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DVNC.AI Hugging Face Space
2
+
3
+ A premium Gradio app for scientific discovery workflows with:
4
+ - cinematic chat interface inspired by modern editorial AI products
5
+ - 3D-style connectome view with active path illumination
6
+ - 7-agent reasoning timeline
7
+ - flippable candidate cards for alternative discovery paths
8
+ - model switching UI for orchestration tiers
9
+
10
+ ## Files
11
+ - `app.py` — entrypoint for Hugging Face Spaces
12
+ - `requirements.txt` — Python dependencies
13
+ - `assets/` — reserved for local assets if needed
14
+
15
+ ## Deploy
16
+ 1. Create a new **Gradio** Space on Hugging Face.
17
+ 2. Upload the full folder contents.
18
+ 3. Ensure the entry file is `app.py`.
19
+ 4. Launch.
20
+
21
+ ## Notes
22
+ This package includes a working front-end prototype and demo orchestration logic. Replace the mock `run_discovery()` function with your production Claude / routing / graph backend.
dvnc_ai_hf/app.py ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import math
3
+ import random
4
+ import gradio as gr
5
+
6
+ MODELS = [
7
+ {"name": "DVNC Sovereign", "tag": "flagship", "desc": "Maximum depth orchestration for frontier discovery"},
8
+ {"name": "DVNC Atlas", "tag": "research", "desc": "Balanced reasoning, graph traversal, and synthesis"},
9
+ {"name": "DVNC Curie", "tag": "lab", "desc": "Experimental hypothesis generation for anomalous signals"},
10
+ ]
11
+
12
+ AGENTS = [
13
+ "Query Interpreter",
14
+ "Graph Divergence Mapper",
15
+ "Evidence Harvester",
16
+ "Analogy Engine",
17
+ "Hypothesis Composer",
18
+ "Adversarial Critic",
19
+ "Experimental Program Designer",
20
+ ]
21
+
22
+ NODES = [
23
+ {"id": "seed", "label": "Seed Query", "group": "core", "x": 0, "y": 0, "z": 0},
24
+ {"id": "bio", "label": "Biomaterials", "group": "domain", "x": 18, "y": 12, "z": -8},
25
+ {"id": "card", "label": "Cardiac Repair", "group": "domain", "x": 34, "y": 2, "z": 14},
26
+ {"id": "nano", "label": "Nanostructure", "group": "bridge", "x": 14, "y": -18, "z": 16},
27
+ {"id": "selfasm", "label": "Self-Assembly", "group": "bridge", "x": 30, "y": -16, "z": -16},
28
+ {"id": "electro", "label": "Electro-signalling", "group": "mechanism", "x": 48, "y": 12, "z": -10},
29
+ {"id": "immune", "label": "Immune Modulation", "group": "mechanism", "x": 54, "y": -8, "z": 10},
30
+ {"id": "trial", "label": "Validation Path", "group": "outcome", "x": 70, "y": 0, "z": 0},
31
+ {"id": "alt1", "label": "Piezoelectric Scaffold", "group": "candidate", "x": 44, "y": 28, "z": 14},
32
+ {"id": "alt2", "label": "Peptide Mesh", "group": "candidate", "x": 42, "y": -28, "z": -14},
33
+ ]
34
+
35
+ EDGES = [
36
+ ("seed", "bio"), ("seed", "nano"), ("bio", "card"), ("nano", "selfasm"),
37
+ ("selfasm", "electro"), ("card", "immune"), ("electro", "trial"), ("immune", "trial"),
38
+ ("card", "alt1"), ("selfasm", "alt2"), ("alt1", "trial"), ("alt2", "trial")
39
+ ]
40
+
41
+ DEFAULT_PATH = ["seed", "nano", "selfasm", "electro", "trial"]
42
+
43
+ CANDIDATES = [
44
+ {
45
+ "title": "Piezoelectric Scaffold Cascade",
46
+ "front": "Use mechano-electric scaffolds to convert cardiac strain into micro-current signalling.",
47
+ "back": "Discovery path: anomalous healing signal -> piezoelectric analog -> ion-channel entrainment -> tissue regeneration. Risk: power density and fibrosis coupling.",
48
+ "score": 92,
49
+ "novelty": "High",
50
+ "agent": "Hypothesis Composer"
51
+ },
52
+ {
53
+ "title": "Peptide Self-Assembly Mesh",
54
+ "front": "Deploy dynamic peptide meshes that self-assemble around damaged myocardium and guide repair.",
55
+ "back": "Discovery path: self-assembly -> local immune choreography -> regenerative substrate formation. Risk: degradation timing and targeting specificity.",
56
+ "score": 88,
57
+ "novelty": "High",
58
+ "agent": "Analogy Engine"
59
+ },
60
+ {
61
+ "title": "Immune-Tuned Conductive Hydrogel",
62
+ "front": "Blend conductivity with macrophage-state modulation to reduce scarring and restore conduction.",
63
+ "back": "Discovery path: inflammation mismatch -> conductive medium -> macrophage polarization -> synchronized healing. Risk: persistence and biocompatibility.",
64
+ "score": 85,
65
+ "novelty": "Medium-High",
66
+ "agent": "Adversarial Critic"
67
+ }
68
+ ]
69
+
70
+
71
+ def build_connectome_html(path_ids):
72
+ active = set(path_ids)
73
+ node_map = {n['id']: n for n in NODES}
74
+ lines = []
75
+ for a, b in EDGES:
76
+ na, nb = node_map[a], node_map[b]
77
+ active_edge = a in active and b in active and abs(path_ids.index(a) - path_ids.index(b)) == 1 if a in path_ids and b in path_ids else False
78
+ cls = "edge active" if active_edge else "edge"
79
+ lines.append(f'<line class="{cls}" x1="{na["x"]*6+420:.1f}" y1="{na["y"]*6+280:.1f}" x2="{nb["x"]*6+420:.1f}" y2="{nb["y"]*6+280:.1f}" />')
80
+ circles = []
81
+ labels = []
82
+ for n in NODES:
83
+ cx = n['x']*6 + 420
84
+ cy = n['y']*6 + 280
85
+ cls = f"node {n['group']} {'active' if n['id'] in active else ''}"
86
+ circles.append(f'<g class="node-wrap"><circle class="{cls}" cx="{cx:.1f}" cy="{cy:.1f}" r="{17 if n["id"] in active else 12}" /><circle class="halo {'active' if n['id'] in active else ''}" cx="{cx:.1f}" cy="{cy:.1f}" r="{28 if n["id"] in active else 0}" /></g>')
87
+ labels.append(f'<text class="label {'active' if n["id"] in active else ''}" x="{cx+16:.1f}" y="{cy-16:.1f}">{n["label"]}</text>')
88
+ return f'''
89
+ <div class="brain-shell">
90
+ <div class="brain-header">
91
+ <div>
92
+ <p class="eyebrow">Connectome</p>
93
+ <h3>Concept Brain</h3>
94
+ </div>
95
+ <div class="brain-legend">
96
+ <span><i class="dot dot-live"></i> active route</span>
97
+ <span><i class="dot dot-node"></i> concept nodes</span>
98
+ </div>
99
+ </div>
100
+ <div class="brain-stage">
101
+ <div class="orb orb-a"></div><div class="orb orb-b"></div>
102
+ <svg viewBox="0 0 840 560" class="brain-svg" role="img" aria-label="DVNC connectome visualisation">
103
+ <defs>
104
+ <filter id="glow"><feGaussianBlur stdDeviation="4" result="c"/><feMerge><feMergeNode in="c"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
105
+ </defs>
106
+ {''.join(lines)}
107
+ {''.join(circles)}
108
+ {''.join(labels)}
109
+ </svg>
110
+ </div>
111
+ </div>
112
+ '''
113
+
114
+
115
+ def build_cards_html(cards):
116
+ items = []
117
+ for i, c in enumerate(cards):
118
+ items.append(f'''
119
+ <article class="candidate-card" tabindex="0">
120
+ <div class="candidate-card-inner">
121
+ <div class="candidate-face candidate-front">
122
+ <div class="candidate-top"><span class="chip">{c['agent']}</span><span class="score">{c['score']}</span></div>
123
+ <h4>{c['title']}</h4>
124
+ <p>{c['front']}</p>
125
+ <div class="meta-row"><span>Novelty</span><strong>{c['novelty']}</strong></div>
126
+ <button class="mini">Flip insight</button>
127
+ </div>
128
+ <div class="candidate-face candidate-back">
129
+ <div class="candidate-top"><span class="chip alt">Alternative path</span><span class="score">{c['score']}</span></div>
130
+ <h4>{c['title']}</h4>
131
+ <p>{c['back']}</p>
132
+ <div class="meta-row"><span>Swap into route</span><strong>Enabled</strong></div>
133
+ <button class="mini">Return</button>
134
+ </div>
135
+ </div>
136
+ </article>
137
+ ''')
138
+ return '<div class="candidate-grid">' + ''.join(items) + '</div>'
139
+
140
+
141
+ def build_agent_timeline(reasoning):
142
+ rows = []
143
+ for r in reasoning:
144
+ rows.append(f'''
145
+ <div class="agent-step">
146
+ <div class="agent-index">{r['step']}</div>
147
+ <div class="agent-copy">
148
+ <div class="agent-head"><h4>{r['agent']}</h4><span>{r['tag']}</span></div>
149
+ <p>{r['summary']}</p>
150
+ </div>
151
+ </div>
152
+ ''')
153
+ return '<div class="timeline">' + ''.join(rows) + '</div>'
154
+
155
+
156
+ def build_chat_html(query, result):
157
+ bubbles = f'''
158
+ <div class="chat-thread">
159
+ <div class="bubble bubble-user">
160
+ <span class="role">You</span>
161
+ <p>{query}</p>
162
+ </div>
163
+ <div class="bubble bubble-ai">
164
+ <span class="role">DVNC Sovereign</span>
165
+ <p>{result['summary']}</p>
166
+ </div>
167
+ <div class="bubble bubble-system">
168
+ <span class="role">Discovery Signal</span>
169
+ <p><strong>Primary hypothesis:</strong> {result['primary_hypothesis']}</p>
170
+ </div>
171
+ </div>
172
+ '''
173
+ return bubbles
174
+
175
+
176
+ def build_models_html(selected):
177
+ items = []
178
+ for m in MODELS:
179
+ active = 'active' if m['name'] == selected else ''
180
+ items.append(f'''<div class="model-pill {active}"><span class="model-name">{m['name']}</span><span class="model-tag">{m['tag']}</span><small>{m['desc']}</small></div>''')
181
+ return '<div class="model-switcher">' + ''.join(items) + '</div>'
182
+
183
+
184
+ def run_discovery(query, model_name):
185
+ random.seed(len(query) + len(model_name))
186
+ if "curie" in query.lower() or "einstein" in query.lower():
187
+ primary = "Map the anomaly first, then force a distant analogy before composing the experimental programme."
188
+ path = ["seed", "bio", "card", "immune", "trial"]
189
+ else:
190
+ primary = "Use a self-assembling conductive scaffold that transforms mechanical strain into local regenerative signalling."
191
+ path = DEFAULT_PATH
192
+ summaries = [
193
+ "Normalises the user prompt into a graph-searchable seed and isolates the tension inside the question.",
194
+ "Finds remote conceptual bridges instead of staying near the starting domain cluster.",
195
+ "Pulls evidence packets and conflict signals required for grounded hypothesis formation.",
196
+ "Generates cross-domain analogies with a bias toward mechanism transfer rather than keyword similarity.",
197
+ "Composes the lead hypothesis and two structurally different variants.",
198
+ "Attacks weak assumptions, hidden confounders, and feasibility gaps.",
199
+ "Produces a staged validation plan with measurable falsification criteria."
200
+ ]
201
+ reasoning = [{"step": i+1, "agent": AGENTS[i], "tag": ["input","graph","evidence","analogy","compose","critique","experiment"][i], "summary": summaries[i]} for i in range(7)]
202
+ result = {
203
+ "summary": "A deeper route was chosen through the concept graph, with live alternatives preserved as candidate cards so the reasoning path can be swapped rather than hidden.",
204
+ "primary_hypothesis": primary,
205
+ "reasoning": reasoning,
206
+ "cards": CANDIDATES,
207
+ "path": path,
208
+ "metrics": {
209
+ "Novelty": 93,
210
+ "Mechanistic clarity": 89,
211
+ "Experimental tractability": 82,
212
+ "Cross-domain distance": 91
213
+ }
214
+ }
215
+ chat_html = build_chat_html(query, result)
216
+ connectome_html = build_connectome_html(path)
217
+ cards_html = build_cards_html(CANDIDATES)
218
+ timeline_html = build_agent_timeline(reasoning)
219
+ metrics = "\n".join([f"- {k}: {v}/100" for k, v in result["metrics"].items()])
220
+ hypothesis = f"""# Discovery Output\n\n**Model:** {model_name}\n\n**Primary hypothesis:** {result['primary_hypothesis']}\n\n## Scoring\n{metrics}\n\n## Experimental outline\n1. Construct the candidate material or protocol.\n2. Test mechanistic signal expression under controlled conditions.\n3. Compare against baseline and nearest-neighbour alternatives.\n4. Falsify using the adversarial risk criteria surfaced in the reasoning path.\n"""
221
+ return chat_html, connectome_html, timeline_html, cards_html, hypothesis, build_models_html(model_name)
222
+
223
+ CSS = r'''
224
+ :root {
225
+ --bg: #08090c;
226
+ --bg2: #0d1015;
227
+ --panel: rgba(17,20,27,.78);
228
+ --panel-solid: #0f131a;
229
+ --panel-2: rgba(21,26,35,.86);
230
+ --line: rgba(255,255,255,.08);
231
+ --soft: rgba(255,255,255,.55);
232
+ --text: #f5f7fb;
233
+ --muted: #8f99ab;
234
+ --gold: #f2d293;
235
+ --teal: #7be7dd;
236
+ --blue: #7ea9ff;
237
+ --shadow: 0 20px 60px rgba(0,0,0,.38);
238
+ --radius: 22px;
239
+ }
240
+ html, body, .gradio-container {
241
+ background: radial-gradient(circle at top left, rgba(120,144,255,.14), transparent 26%),
242
+ radial-gradient(circle at 90% 10%, rgba(242,210,147,.11), transparent 22%),
243
+ linear-gradient(180deg, #050608 0%, #090b10 50%, #07080c 100%) !important;
244
+ color: var(--text) !important;
245
+ font-family: Inter, ui-sans-serif, system-ui, sans-serif;
246
+ }
247
+ .gradio-container {max-width: 1550px !important; padding: 22px !important;}
248
+ #dvnc-shell {border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: linear-gradient(180deg, rgba(14,17,24,.86), rgba(7,8,12,.9)); box-shadow: var(--shadow); backdrop-filter: blur(18px);}
249
+ #dvnc-shell .wrap {display:grid; grid-template-columns: 1.12fr .88fr; min-height: 84vh;}
250
+ #dvnc-shell .left, #dvnc-shell .right {padding: 24px;}
251
+ #dvnc-shell .left {border-right: 1px solid var(--line); display:flex; flex-direction:column; gap:18px;}
252
+ #dvnc-shell .right {display:grid; grid-template-rows:auto auto 1fr auto; gap:18px;}
253
+ .hero-bar {display:flex; justify-content:space-between; align-items:center; gap:16px; padding-bottom:8px;}
254
+ .brand {display:flex; align-items:center; gap:14px;}
255
+ .logo {width:42px; height:42px; border-radius:14px; background: linear-gradient(135deg, rgba(242,210,147,.28), rgba(123,231,221,.16)); border:1px solid rgba(255,255,255,.1); display:grid; place-items:center; box-shadow: inset 0 1px 0 rgba(255,255,255,.08);}
256
+ .logo svg {width:24px; height:24px; color: var(--gold);}
257
+ .brand h1 {font-size: 1.05rem; margin:0; font-weight: 650; letter-spacing:.02em;}
258
+ .brand p {margin:3px 0 0; color:var(--muted); font-size:.84rem;}
259
+ .status {display:flex; gap:10px; align-items:center; color:var(--soft); font-size:.85rem;}
260
+ .status-dot {width:10px; height:10px; border-radius:50%; background:var(--teal); box-shadow:0 0 0 6px rgba(123,231,221,.08), 0 0 18px rgba(123,231,221,.4);}
261
+ .panel {background: linear-gradient(180deg, rgba(17,20,27,.82), rgba(12,14,19,.76)); border:1px solid var(--line); border-radius: 22px; box-shadow: inset 0 1px 0 rgba(255,255,255,.04);}
262
+ .chat-panel {padding:18px; display:flex; flex-direction:column; gap:14px; min-height: 340px;}
263
+ .querybox textarea, .querybox input {background: transparent !important; color: var(--text) !important;}
264
+ .querybox, .querybox > div {background: rgba(255,255,255,.02) !important; border-radius: 18px !important; border-color: var(--line) !important;}
265
+ .chat-thread {display:flex; flex-direction:column; gap:14px;}
266
+ .bubble {max-width: 86%; padding:16px 18px; border-radius: 22px; position:relative; border:1px solid var(--line);}
267
+ .bubble p {margin:8px 0 0; line-height:1.6; font-size:.96rem;}
268
+ .bubble .role {font-size:.72rem; letter-spacing:.12em; text-transform:uppercase; color:var(--muted);}
269
+ .bubble-user {align-self:flex-end; background: linear-gradient(135deg, rgba(126,169,255,.18), rgba(126,169,255,.08));}
270
+ .bubble-ai {align-self:flex-start; background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.03));}
271
+ .bubble-system {align-self:flex-start; background: linear-gradient(135deg, rgba(242,210,147,.12), rgba(242,210,147,.04));}
272
+ .model-switcher {display:grid; grid-template-columns:repeat(3,1fr); gap:12px;}
273
+ .model-pill {padding:14px; border:1px solid var(--line); border-radius:18px; background:rgba(255,255,255,.02); display:flex; flex-direction:column; gap:4px; min-height: 96px;}
274
+ .model-pill.active {border-color: rgba(242,210,147,.45); background: linear-gradient(135deg, rgba(242,210,147,.14), rgba(255,255,255,.03)); box-shadow: inset 0 0 0 1px rgba(242,210,147,.08);}
275
+ .model-name {font-weight:650;}
276
+ .model-tag {font-size:.76rem; text-transform:uppercase; letter-spacing:.12em; color:var(--gold);}
277
+ .model-pill small {color:var(--muted); line-height:1.45;}
278
+ .brain-shell {padding:18px; height:100%;}
279
+ .brain-header {display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:10px;}
280
+ .eyebrow {font-size:.72rem; letter-spacing:.16em; text-transform:uppercase; color:var(--gold); margin:0 0 4px;}
281
+ .brain-header h3 {margin:0; font-size:1.12rem;}
282
+ .brain-legend {display:flex; gap:14px; color:var(--muted); font-size:.8rem; flex-wrap:wrap;}
283
+ .dot {width:10px; height:10px; display:inline-block; border-radius:50%; margin-right:6px;}
284
+ .dot-live {background:var(--gold); box-shadow:0 0 12px rgba(242,210,147,.65);} .dot-node {background:var(--teal);}
285
+ .brain-stage {position:relative; min-height: 360px; border-radius:20px; overflow:hidden; background: radial-gradient(circle at center, rgba(126,169,255,.08), transparent 35%), linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)); border:1px solid rgba(255,255,255,.05);}
286
+ .orb {position:absolute; border-radius:50%; filter: blur(40px); opacity:.28; pointer-events:none;}
287
+ .orb-a {width:180px; height:180px; background:rgba(123,231,221,.16); left:10%; top:18%;}
288
+ .orb-b {width:220px; height:220px; background:rgba(242,210,147,.12); right:8%; bottom:12%;}
289
+ .brain-svg {width:100%; height:100%; min-height:360px; transform: perspective(1200px) rotateX(10deg) rotateY(-8deg) scale(1.02);}
290
+ .edge {stroke: rgba(132,153,184,.18); stroke-width:2.2;}
291
+ .edge.active {stroke: var(--gold); stroke-width:3.4; filter:url(#glow); stroke-dasharray: 8 8; animation: pulseEdge 2.8s linear infinite;}
292
+ .node {fill:#7ea9ff; opacity:.88;}
293
+ .node.core {fill:#f5f7fb;} .node.domain {fill:#7be7dd;} .node.bridge {fill:#8ea4ff;} .node.mechanism {fill:#f2d293;} .node.outcome {fill:#ffd9a6;} .node.candidate {fill:#ddadff;}
294
+ .node.active {stroke:#fff7df; stroke-width:2.4; filter:url(#glow);}
295
+ .halo {fill:none;} .halo.active {stroke: rgba(242,210,147,.22); stroke-width:10;}
296
+ .label {fill: rgba(245,247,251,.68); font-size: 12px; letter-spacing: .02em;} .label.active {fill: #fff8e8;}
297
+ .timeline {display:flex; flex-direction:column; gap:10px;}
298
+ .agent-step {display:grid; grid-template-columns:42px 1fr; gap:12px; padding:12px; border:1px solid var(--line); border-radius:18px; background:rgba(255,255,255,.02);}
299
+ .agent-index {width:42px; height:42px; border-radius:14px; display:grid; place-items:center; font-weight:700; color:var(--gold); background:rgba(242,210,147,.08); border:1px solid rgba(242,210,147,.16);}
300
+ .agent-head {display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:4px;}
301
+ .agent-head h4 {margin:0; font-size:.98rem;} .agent-head span {font-size:.72rem; letter-spacing:.12em; text-transform:uppercase; color:var(--muted);} .agent-copy p {margin:0; color:#cbd3e2; font-size:.9rem; line-height:1.55;}
302
+ .candidate-grid {display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:14px;}
303
+ .candidate-card {background:none; perspective:1200px; min-height: 250px;}
304
+ .candidate-card-inner {position:relative; width:100%; height:100%; min-height:250px; transition: transform .8s cubic-bezier(.2,.7,.1,1); transform-style:preserve-3d;}
305
+ .candidate-card:hover .candidate-card-inner, .candidate-card:focus .candidate-card-inner, .candidate-card:focus-within .candidate-card-inner {transform: rotateY(180deg) translateY(-4px);}
306
+ .candidate-face {position:absolute; inset:0; padding:18px; border-radius:22px; border:1px solid var(--line); background: linear-gradient(180deg, rgba(19,22,29,.96), rgba(11,13,18,.96)); backface-visibility:hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.04), var(--shadow); display:flex; flex-direction:column; gap:12px;}
307
+ .candidate-back {transform: rotateY(180deg); background: linear-gradient(180deg, rgba(29,23,16,.96), rgba(12,11,10,.96));}
308
+ .candidate-top {display:flex; justify-content:space-between; align-items:center; gap:8px;}
309
+ .chip {font-size:.72rem; text-transform:uppercase; letter-spacing:.12em; color:var(--teal); padding:7px 10px; border-radius:999px; background:rgba(123,231,221,.08); border:1px solid rgba(123,231,221,.18);} .chip.alt {color:var(--gold); background:rgba(242,210,147,.08); border-color: rgba(242,210,147,.18);}
310
+ .score {font-weight:700; color:var(--gold);}
311
+ .candidate-face h4 {margin:0; font-size:1rem; line-height:1.3;}
312
+ .candidate-face p {margin:0; color:#cbd3e2; line-height:1.6; font-size:.92rem;}
313
+ .meta-row {margin-top:auto; display:flex; justify-content:space-between; color:var(--muted); font-size:.84rem;}
314
+ .mini {margin-top:8px; align-self:flex-start; color:var(--text); padding:10px 12px; border-radius:14px; border:1px solid var(--line); background:rgba(255,255,255,.03);}
315
+ .prosebox {padding:18px; white-space:pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height:1.55; color:#dfe6f3;}
316
+ .gr-button-primary {background: linear-gradient(135deg, rgba(242,210,147,.92), rgba(224,178,92,.92)) !important; color:#1b1408 !important; border: none !important;}
317
+ .gr-button-secondary {background: rgba(255,255,255,.05) !important; color: var(--text) !important; border: 1px solid var(--line) !important;}
318
+ footer {display:none !important;}
319
+ @keyframes pulseEdge {to {stroke-dashoffset: -32;}}
320
+ @media (max-width: 1180px){#dvnc-shell .wrap{grid-template-columns:1fr;}#dvnc-shell .left{border-right:0;border-bottom:1px solid var(--line)}.candidate-grid,.model-switcher{grid-template-columns:1fr;} }
321
+ '''
322
+
323
+ HEAD = '''
324
+ <link rel="preconnect" href="https://fonts.googleapis.com">
325
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
326
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
327
+ '''
328
+
329
+ with gr.Blocks(css=CSS, head=HEAD, theme=gr.themes.Base(), fill_height=True) as demo:
330
+ gr.HTML('''
331
+ <div id="dvnc-shell">
332
+ <div class="wrap">
333
+ <section class="left">
334
+ <div class="hero-bar">
335
+ <div class="brand">
336
+ <div class="logo" aria-hidden="true">
337
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M5 17L12 4l7 13"/><path d="M8.5 12.5h7"/><circle cx="12" cy="12" r="1.8" fill="currentColor" stroke="none"/></svg>
338
+ </div>
339
+ <div>
340
+ <h1>DVNC.AI</h1>
341
+ <p>Sovereign discovery interface · connectome-native reasoning</p>
342
+ </div>
343
+ </div>
344
+ <div class="status"><span class="status-dot"></span><span>Live orchestration</span></div>
345
+ </div>
346
+ ''')
347
+ model_html = gr.HTML(build_models_html("DVNC Sovereign"))
348
+ with gr.Row():
349
+ model = gr.Dropdown(choices=[m["name"] for m in MODELS], value="DVNC Sovereign", label="Model tier")
350
+ query = gr.Textbox(label="Discovery query", elem_classes=["querybox"], placeholder="Enter a scientific question, anomaly, or breakthrough direction…", lines=4)
351
+ with gr.Row():
352
+ run_btn = gr.Button("Run discovery", variant="primary")
353
+ example_btn = gr.Button("Load example", variant="secondary")
354
+ chat = gr.HTML('<div class="panel chat-panel"><div class="chat-thread"><div class="bubble bubble-ai"><span class="role">DVNC</span><p>Enter a query to activate the 7-agent discovery stack and illuminate the chosen path through the concept brain.</p></div></div></div>')
355
+ gr.HTML('</section><section class="right">')
356
+ connectome = gr.HTML(build_connectome_html(DEFAULT_PATH))
357
+ timeline = gr.HTML('<div class="panel" style="padding:18px"><div class="timeline"></div></div>')
358
+ cards = gr.HTML('<div class="panel" style="padding:18px"><div class="candidate-grid"></div></div>')
359
+ output = gr.Markdown("# Discovery Output\n\nAwaiting query.")
360
+ gr.HTML('</section></div></div>')
361
+
362
+ def load_example():
363
+ return "How could a self-assembling conductive biomaterial improve cardiac tissue regeneration by converting mechanical strain into repair signalling?"
364
+
365
+ example_btn.click(fn=load_example, outputs=query)
366
+ run_btn.click(fn=run_discovery, inputs=[query, model], outputs=[chat, connectome, timeline, cards, output, model_html])
367
+
368
+ if __name__ == "__main__":
369
+ demo.launch()
dvnc_ai_hf/requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio>=5.29.0
2
+ networkx>=3.2
3
+ numpy>=1.26.0
4
+ plotly>=5.24.0