Spaces:
Sleeping

byte-vortex commited on
Commit
ec134f7
·
verified ·
1 Parent(s): c28b40f

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. ui/gradio_app.py +0 -233
ui/gradio_app.py CHANGED
@@ -400,239 +400,6 @@ def build_app():
400
  interactive=False
401
  )
402
 
403
- def myco_animation_card_markdown() -> str:
404
- return """
405
- <div id="myco-card-container" class="myco-anim-card">
406
- <style>
407
- .myco-anim-card {
408
- position: relative;
409
- width: 100%;
410
- max-width: 600px;
411
- height: 320px;
412
- margin: 20px auto;
413
- background: #050a08;
414
- border: 1px solid rgba(82, 255, 107, 0.15);
415
- border-radius: 12px;
416
- overflow: hidden;
417
- font-family: 'Inter', sans-serif;
418
- box-shadow: 0 10px 30px rgba(0,0,0,0.5);
419
- }
420
-
421
- #myco-card-overlay {
422
- position: absolute;
423
- top: 0; left: 0; width: 100%; height: 100%;
424
- pointer-events: none;
425
- z-index: 1;
426
- opacity: 0.12;
427
- transition: opacity 0.4s ease;
428
- }
429
-
430
- .m-grid { background-image: radial-gradient(rgba(255,255,255,0.15) 1px, transparent 1px); background-size: 20px 20px; }
431
- .m-lines { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 3px); }
432
- .m-noise { background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
433
-
434
- #myco-card-canvas {
435
- display: block;
436
- position: absolute;
437
- top: 0; left: 0;
438
- width: 100%;
439
- height: 100%;
440
- z-index: 2;
441
- filter: contrast(1.1) brightness(1.1);
442
- }
443
-
444
- #myco-card-ui {
445
- position: absolute; top: 12px; left: 0; width: 100%;
446
- color: rgba(168, 255, 178, 0.5); font-size: 9px; letter-spacing: 3px;
447
- pointer-events: none; text-transform: uppercase; z-index: 10;
448
- text-align: center; line-height: 1.6;
449
- }
450
-
451
- #myco-card-footer {
452
- position: absolute; bottom: 12px; left: 16px; right: 16px;
453
- color: rgba(255, 255, 255, 0.25); font-size: 8px;
454
- letter-spacing: 1px; text-transform: uppercase; z-index: 10;
455
- display: flex; justify-content: space-between;
456
- }
457
-
458
- .myco-highlight { color: #00f2fe; font-weight: bold; }
459
-
460
- @keyframes cardShake {
461
- 0% { transform: translate(1px, 1px); }
462
- 20% { transform: translate(-2px, 0px); }
463
- 40% { transform: translate(1px, -1px); }
464
- 100% { transform: translate(1px, 1px); }
465
- }
466
- .card-shaking { animation: cardShake 0.15s infinite; }
467
- </style>
468
-
469
- <div id="myco-card-overlay" class="m-grid"></div>
470
- <div id="myco-card-ui">
471
- BIOME MUTATION: <span id="myco-card-msg">SCANNING NETWORKS...</span><br>
472
- <small style="font-size: 7px; opacity: 0.6; letter-spacing: 0.5px;">(CLICK CARD TO INTERACT WITH AUDIO RESONANCE)</small>
473
- </div>
474
-
475
- <canvas id="myco-card-canvas"></canvas>
476
-
477
- <div id="myco-card-footer">
478
- <div>ENGINE: <span class="myco-highlight">MYCO MATRIX</span></div>
479
- <div id="myco-card-date"></div>
480
- </div>
481
-
482
- <script>
483
- (function() {
484
- const container = document.getElementById('myco-card-container');
485
- const canvas = document.getElementById('myco-card-canvas');
486
- const ctx = canvas.getContext('2d');
487
- const overlay = document.getElementById('myco-card-overlay');
488
- const msg = document.getElementById('myco-card-msg');
489
-
490
- let audioCtx = null;
491
- function initAudio() {
492
- if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)();
493
- if (audioCtx.state === 'suspended') audioCtx.resume();
494
- }
495
-
496
- const textures = ['m-grid', 'm-lines', 'm-noise'];
497
- const sequence = ["🍄", "MYCO", "🍄‍🟫", "SPORE", "GILLS", "🍄", "CAP", "HYPHAE", "ROOTS"];
498
-
499
- let currentStep = 0;
500
- let isExposed = false;
501
- let w, h, dpr, particles = [];
502
-
503
- const sCanvas = document.createElement('canvas');
504
- const sCtx = sCanvas.getContext('2d', { willReadFrequently: true });
505
-
506
- class Particle {
507
- constructor() {
508
- this.x = Math.random() * container.clientWidth;
509
- this.y = Math.random() * container.clientHeight;
510
- this.tx = this.x; this.ty = this.y;
511
- this.vx = 0; this.vy = 0;
512
- this.size = Math.random() * 1.5 + 1;
513
- this.color = '#fff';
514
- }
515
- update() {
516
- if (isExposed) {
517
- this.x += this.vx; this.y += this.vy;
518
- this.vx *= 0.95; this.vy *= 0.95;
519
- } else {
520
- this.vx = (this.tx - this.x) * 0.15;
521
- this.vy = (this.ty - this.y) * 0.15;
522
- this.x += this.vx; this.y += this.vy;
523
- }
524
- }
525
- draw() {
526
- ctx.fillStyle = this.color;
527
- ctx.fillRect(this.x, this.y, this.size, this.size);
528
- }
529
- }
530
-
531
- function resizeCard() {
532
- if (!container.clientWidth) return;
533
- dpr = window.devicePixelRatio || 1;
534
- w = container.clientWidth;
535
- h = container.clientHeight;
536
- canvas.width = w * dpr; canvas.height = h * dpr;
537
- ctx.scale(dpr, dpr);
538
- sCanvas.width = w; sCanvas.height = h;
539
- if(!isExposed && currentStep < sequence.length) morph(sequence[currentStep]);
540
- }
541
-
542
- function morph(content) {
543
- sCtx.clearRect(0, 0, w, h);
544
- sCtx.fillStyle = "white";
545
- sCtx.textAlign = "center";
546
- sCtx.textBaseline = "middle";
547
-
548
- const baseSize = Math.min(w, h) * 0.55;
549
- const fontSize = content.length > 2 ? baseSize / (content.length * 0.45) : baseSize;
550
- sCtx.font = `bold ${fontSize}px sans-serif`;
551
- sCtx.fillText(content, w / 2, h / 2 + 10);
552
-
553
- overlay.className = textures[currentStep % textures.length];
554
- overlay.style.opacity = (0.04 + (Math.random() * 0.1)).toString();
555
-
556
- const imgData = sCtx.getImageData(0, 0, w, h).data;
557
- const points = [];
558
- for (let y = 0; y < h; y += 4) {
559
- for (let x = 0; x < w; x += 4) {
560
- if (imgData[(y * w + x) * 4 + 3] > 128) points.push({x, y});
561
- }
562
- }
563
-
564
- if (particles.length < points.length) {
565
- for (let i = particles.length; i < points.length; i++) particles.push(new Particle());
566
- }
567
-
568
- particles.forEach((p, i) => {
569
- const pt = points[i % points.length];
570
- p.tx = pt.x; p.ty = pt.y;
571
- if (content === "BLOOM") {
572
- p.color = "#00f2fe";
573
- } else {
574
- p.color = `hsl(${130 + (currentStep * 22)}, 80%, 65%)`;
575
- }
576
- });
577
-
578
- if (content !== "BLOOM") {
579
- container.classList.add('card-shaking');
580
- setTimeout(() => container.classList.remove('card-shaking'), 100);
581
- }
582
- }
583
-
584
- function expose() {
585
- isExposed = true;
586
- msg.innerText = "SPORE BURST EXTRACTION";
587
- overlay.className = 'm-noise';
588
- overlay.style.opacity = "0.35";
589
-
590
- particles.forEach(p => {
591
- const angle = Math.random() * Math.PI * 2;
592
- const vel = Math.random() * 15 + 8;
593
- p.vx = Math.cos(angle) * vel;
594
- p.vy = Math.sin(angle) * vel;
595
- p.color = `hsl(${Math.random() * 40 + 290}, 95%, 65%)`;
596
- });
597
-
598
- setTimeout(() => {
599
- isExposed = false;
600
- msg.innerText = "BIOME INTEGRATED";
601
- morph("BLOOM");
602
- }, 1400);
603
- }
604
-
605
- function loop() {
606
- ctx.fillStyle = 'rgba(5, 10, 8, 0.2)';
607
- ctx.fillRect(0, 0, w, h);
608
- particles.forEach(p => { p.update(); p.draw(); });
609
- requestAnimationFrame(loop);
610
- }
611
-
612
- container.addEventListener('mousedown', initAudio);
613
- window.addEventListener('resize', resizeCard);
614
- document.getElementById('myco-card-date').textContent = new Date().toLocaleDateString();
615
-
616
- setTimeout(() => {
617
- resizeCard();
618
- const timer = setInterval(() => {
619
- if (!isExposed && msg.innerText !== "BIOME INTEGRATED") {
620
- currentStep++;
621
- if (currentStep < sequence.length) {
622
- msg.innerText = `MUTATION // ${sequence[currentStep]}`;
623
- morph(sequence[currentStep]);
624
- } else {
625
- clearInterval(timer);
626
- expose();
627
- }
628
- }
629
- }, 1300);
630
- loop();
631
- }, 300);
632
- })();
633
- </script>
634
- </div>
635
- """
636
 
637
  # --- Your Gradio Layout Interface ---
638
  with gr.Blocks() as demo:
 
400
  interactive=False
401
  )
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
  # --- Your Gradio Layout Interface ---
405
  with gr.Blocks() as demo: