Prometech Computer Sciences Corp commited on
Commit
f355471
·
verified ·
1 Parent(s): f75b08f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -121
app.py CHANGED
@@ -10,6 +10,10 @@ REPO_ID = "pthcorp/prettybird_bce_basic_simplesecurity"
10
  MODEL_FILENAME = "prettybird_bce_basic_asena_fp16.gguf"
11
 
12
  LOGO_URL = "https://prometech.net.tr/wp-content/uploads/2025/10/pthheader.png"
 
 
 
 
13
 
14
  HEADER_MD = f"""
15
  <div class="pb-header">
@@ -528,70 +532,22 @@ textarea, input, .gr-textbox, .gr-textbox * {
528
  }
529
 
530
  /* ===== MUSIC CORE ===== */
531
- /* Stars never block clicks */
532
- #stars, #stars2, #stars3{ pointer-events:none !important; }
533
-
534
- /* Music widget – ALWAYS visible */
535
- #pb-music-widget{
536
- position: fixed;
537
- right: 18px;
538
- bottom: 18px;
539
- z-index: 2147483647; /* max */
540
- pointer-events: auto;
541
- }
542
-
543
- /* Single neon button */
544
- #pb-play-btn{
545
- position: relative;
546
- width: 66px;
547
- height: 66px;
548
- border-radius: 50%;
549
- background: rgba(0,0,0,0.92);
550
- border: 2px solid var(--terminal-fg);
551
- color: var(--terminal-fg);
552
- cursor: pointer;
553
- box-shadow: 0 0 12px rgba(0,255,65,0.55), 0 0 22px rgba(0,255,65,0.25) inset;
554
- font-family: var(--terminal-font);
555
- overflow: visible; /* rings can overflow */
556
- }
557
-
558
- #pb-play-btn:focus{ outline:none; }
559
-
560
- #pb-play-btn .pb-icon{
561
- font-size: 24px;
562
- line-height: 1;
563
- text-shadow: 0 0 10px rgba(0,255,65,0.5);
564
- }
565
-
566
- /* Halo EQ rings */
567
- #pb-play-btn .eq-ring{
568
- position: absolute;
569
- inset: -8px;
570
- border-radius: 50%;
571
- border: 1px solid rgba(0,255,65,0.55);
572
- opacity: 0;
573
- pointer-events: none;
574
- }
575
-
576
- #pb-play-btn.playing .eq-ring{
577
- opacity: 1;
578
- animation: eqPulse 1.6s ease-out infinite;
579
- }
580
-
581
- #pb-play-btn.playing .r2{ animation-delay: .35s; }
582
- #pb-play-btn.playing .r3{ animation-delay: .7s; }
583
-
584
- @keyframes eqPulse{
585
- 0% { transform: scale(1); opacity: 0.75; }
586
- 65% { transform: scale(1.65);opacity: 0.05; }
587
- 100% { transform: scale(1.75);opacity: 0; }
588
- }
589
-
590
- @media (max-width:520px){
591
- #pb-music-widget{ right: 12px; bottom: 12px; }
592
- #pb-play-btn{ width: 60px; height: 60px; }
593
- }
594
-
595
  </style>
596
  """
597
 
@@ -642,64 +598,24 @@ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as
642
  '</div>'
643
  )
644
  # Music
645
- gr.HTML("""
646
- <div id="pb-music-anchor"></div>
647
-
648
- <script>
649
- (function(){
650
- // Avoid double-inject on hot reload
651
- if (document.getElementById("pb-music-widget")) return;
652
-
653
- const html = `
654
- <div id="pb-music-widget">
655
- <button id="pb-play-btn" aria-label="Play/Pause">
656
- <span class="pb-icon">▶</span>
657
- <span class="eq-ring r1"></span>
658
- <span class="eq-ring r2"></span>
659
- <span class="eq-ring r3"></span>
660
- </button>
661
-
662
- <audio id="pb-audio" preload="auto" loop>
663
- <source src="/file=planet_elimination.mp3" type="audio/mpeg">
664
- </audio>
665
- </div>
666
- `;
667
-
668
- document.body.insertAdjacentHTML("beforeend", html);
669
-
670
- const audio = document.getElementById("pb-audio");
671
- const btn = document.getElementById("pb-play-btn");
672
- const icon = btn.querySelector(".pb-icon");
673
-
674
- let playing = false;
675
-
676
- function setState(isPlaying){
677
- playing = isPlaying;
678
- btn.classList.toggle("playing", isPlaying);
679
- icon.textContent = isPlaying ? "❚❚" : "▶";
680
- }
681
 
682
- btn.addEventListener("click", async () => {
683
- try{
684
- if(!playing){
685
- await audio.play(); // requires user gesture, this is it
686
- setState(true);
687
- }else{
688
- audio.pause();
689
- setState(false);
690
- }
691
- }catch(e){
692
- console.log("Audio play blocked or error:", e);
693
- // If still blocked, keep as paused
694
- setState(false);
695
- }
696
- });
697
-
698
- audio.addEventListener("pause", () => setState(false));
699
- audio.addEventListener("play", () => setState(true));
700
-
701
- setState(false);
702
- })();
703
  </script>
704
  """)
705
 
 
10
  MODEL_FILENAME = "prettybird_bce_basic_asena_fp16.gguf"
11
 
12
  LOGO_URL = "https://prometech.net.tr/wp-content/uploads/2025/10/pthheader.png"
13
+ MUSIC_TITLE = "Planet Elimination"
14
+ MUSIC_ARTIST = "MuzaProduction"
15
+ MUSIC_LINK = "https://elements.envato.com/planet-elimination-6KSM6KT"
16
+ MUSIC_FILE_REL = "planet_elimination.mp3" # ana klasörde OK
17
 
18
  HEADER_MD = f"""
19
  <div class="pb-header">
 
532
  }
533
 
534
  /* ===== MUSIC CORE ===== */
535
+ .pb-music-wrap{
536
+ position:fixed;
537
+ right:14px;
538
+ bottom:14px;
539
+ z-index:9999;
540
+ width:min(360px, 92vw);
541
+ background:rgba(0,0,0,0.75);
542
+ border:1px solid rgba(0,255,65,0.35);
543
+ border-radius:14px;
544
+ padding:10px 12px;
545
+ box-shadow:0 0 14px rgba(0,0,0,0.85);
546
+ backdrop-filter: blur(6px);
547
+ }
548
+ .pb-music-title{ color:#d9ffe0; margin:0 0 6px 0; font-size:0.95rem; letter-spacing:0.06em; }
549
+ .pb-music-wrap a{ color:#9affc0; text-decoration:none; }
550
+ .pb-music-wrap a:hover{ text-decoration:underline; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  </style>
552
  """
553
 
 
598
  '</div>'
599
  )
600
  # Music
601
+ # Music: use gr.Audio so file actually serves
602
+ with gr.Group(elem_classes=["pb-music-wrap"]):
603
+ gr.HTML(
604
+ f"""
605
+ <div class="pb-music-title">
606
+ 🎵 {MUSIC_TITLE} {MUSIC_ARTIST}
607
+ <a href="{MUSIC_LINK}" target="_blank" rel="noopener">Source</a>
608
+ </div>
609
+ """
610
+ )
611
+ music = gr.Audio(
612
+ value=MUSIC_FILE_REL, # relative path in repo
613
+ autoplay=True,
614
+ loop=True,
615
+ interactive=True,
616
+ show_label=False,
617
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  </script>
620
  """)
621