Spaces:
Running
Running
Prometech Computer Sciences Corp
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -766,84 +766,7 @@ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as
|
|
| 766 |
<div id="stars2"></div>
|
| 767 |
<div id="stars3"></div>
|
| 768 |
""")
|
| 769 |
-
gr.HTML(""
|
| 770 |
-
<canvas id="pb-binary"></canvas>
|
| 771 |
-
|
| 772 |
-
<script>
|
| 773 |
-
(() => {
|
| 774 |
-
const canvas = document.getElementById("pb-binary");
|
| 775 |
-
if (!canvas) return;
|
| 776 |
-
|
| 777 |
-
const ctx = canvas.getContext("2d", { alpha: true });
|
| 778 |
-
|
| 779 |
-
const COLORS = ["#118188", "#233cad"]; // camgöbeği + codeblue
|
| 780 |
-
const PHRASE = "CICIKUŞ PROMETECH DAVRANIŞSAL BİLİNÇ MOTORU";
|
| 781 |
-
|
| 782 |
-
let w, h, cols, drops, fontSize;
|
| 783 |
-
|
| 784 |
-
function resize() {
|
| 785 |
-
const dpr = Math.max(1, window.devicePixelRatio || 1);
|
| 786 |
-
w = Math.floor(window.innerWidth);
|
| 787 |
-
h = Math.floor(window.innerHeight);
|
| 788 |
-
|
| 789 |
-
canvas.style.width = w + "px";
|
| 790 |
-
canvas.style.height = h + "px";
|
| 791 |
-
canvas.width = Math.floor(w * dpr);
|
| 792 |
-
canvas.height = Math.floor(h * dpr);
|
| 793 |
-
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
| 794 |
-
|
| 795 |
-
fontSize = Math.max(14, Math.min(20, Math.floor(w / 80))); // responsive
|
| 796 |
-
cols = Math.floor(w / fontSize);
|
| 797 |
-
drops = new Array(cols).fill(0).map(() => Math.random() * h);
|
| 798 |
-
}
|
| 799 |
-
|
| 800 |
-
// random: 0/1 ve araya nadiren phrase’ten karakter
|
| 801 |
-
function pickChar() {
|
| 802 |
-
if (Math.random() < 0.06) {
|
| 803 |
-
return PHRASE[Math.floor(Math.random() * PHRASE.length)];
|
| 804 |
-
}
|
| 805 |
-
return Math.random() < 0.5 ? "0" : "1";
|
| 806 |
-
}
|
| 807 |
-
|
| 808 |
-
function draw() {
|
| 809 |
-
// fade (iz bırakma)
|
| 810 |
-
ctx.fillStyle = "rgba(0, 0, 0, 0.08)";
|
| 811 |
-
ctx.fillRect(0, 0, w, h);
|
| 812 |
-
|
| 813 |
-
ctx.font = fontSize + "px VT323, monospace";
|
| 814 |
-
|
| 815 |
-
for (let i = 0; i < cols; i++) {
|
| 816 |
-
const x = i * fontSize;
|
| 817 |
-
const y = drops[i];
|
| 818 |
-
|
| 819 |
-
const ch = pickChar();
|
| 820 |
-
const c = COLORS[(i + Math.floor(y / fontSize)) % COLORS.length];
|
| 821 |
-
|
| 822 |
-
// glow
|
| 823 |
-
ctx.shadowColor = c;
|
| 824 |
-
ctx.shadowBlur = 10;
|
| 825 |
-
|
| 826 |
-
ctx.fillStyle = c;
|
| 827 |
-
ctx.fillText(ch, x, y);
|
| 828 |
-
|
| 829 |
-
// hız (orta): 0.9–1.4 arası
|
| 830 |
-
drops[i] += fontSize * (0.9 + Math.random() * 0.5);
|
| 831 |
-
|
| 832 |
-
// reset
|
| 833 |
-
if (drops[i] > h + 50 && Math.random() > 0.985) {
|
| 834 |
-
drops[i] = -Math.random() * 300;
|
| 835 |
-
}
|
| 836 |
-
}
|
| 837 |
-
|
| 838 |
-
requestAnimationFrame(draw);
|
| 839 |
-
}
|
| 840 |
-
|
| 841 |
-
resize();
|
| 842 |
-
window.addEventListener("resize", resize, { passive: true });
|
| 843 |
-
draw();
|
| 844 |
-
})();
|
| 845 |
-
</script>
|
| 846 |
-
""")
|
| 847 |
|
| 848 |
gr.Markdown(HEADER_MD)
|
| 849 |
|
|
@@ -914,5 +837,80 @@ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as
|
|
| 914 |
elem_classes=["pb-audio"]
|
| 915 |
)
|
| 916 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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EADER_MD)
|
| 772 |
|
|
|
|
| 837 |
elem_classes=["pb-audio"]
|
| 838 |
)
|
| 839 |
|
| 840 |
+
BINARY_JS = r"""
|
| 841 |
+
() => {
|
| 842 |
+
// bazen DOM geç geliyor; küçük retry
|
| 843 |
+
const tryInit = (tries=0) => {
|
| 844 |
+
const canvas = document.getElementById("pb-binary");
|
| 845 |
+
if (!canvas) {
|
| 846 |
+
if (tries < 40) setTimeout(() => tryInit(tries+1), 150);
|
| 847 |
+
return;
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
const ctx = canvas.getContext("2d", { alpha: true });
|
| 851 |
+
const COLORS = ["#118188", "#233cad"];
|
| 852 |
+
const PHRASE = "CICIKUŞ PROMETECH DAVRANIŞSAL BİLİNÇ MOTORU";
|
| 853 |
+
|
| 854 |
+
let w=0, h=0, cols=0, drops=[], fontSize=16;
|
| 855 |
+
|
| 856 |
+
const resize = () => {
|
| 857 |
+
const dpr = Math.max(1, window.devicePixelRatio || 1);
|
| 858 |
+
w = Math.floor(window.innerWidth);
|
| 859 |
+
h = Math.floor(window.innerHeight);
|
| 860 |
+
|
| 861 |
+
canvas.style.width = w + "px";
|
| 862 |
+
canvas.style.height = h + "px";
|
| 863 |
+
canvas.width = Math.floor(w * dpr);
|
| 864 |
+
canvas.height = Math.floor(h * dpr);
|
| 865 |
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
| 866 |
+
|
| 867 |
+
fontSize = Math.max(14, Math.min(20, Math.floor(w / 80)));
|
| 868 |
+
cols = Math.max(10, Math.floor(w / fontSize));
|
| 869 |
+
drops = new Array(cols).fill(0).map(() => Math.random() * h);
|
| 870 |
+
};
|
| 871 |
+
|
| 872 |
+
const pickChar = () => {
|
| 873 |
+
if (Math.random() < 0.06) return PHRASE[Math.floor(Math.random() * PHRASE.length)];
|
| 874 |
+
return Math.random() < 0.5 ? "0" : "1";
|
| 875 |
+
};
|
| 876 |
+
|
| 877 |
+
const draw = () => {
|
| 878 |
+
// iz bırakma: çok karartmasın diye alpha düşük
|
| 879 |
+
ctx.fillStyle = "rgba(0,0,0,0.05)";
|
| 880 |
+
ctx.fillRect(0, 0, w, h);
|
| 881 |
+
|
| 882 |
+
ctx.font = fontSize + "px VT323, monospace";
|
| 883 |
+
|
| 884 |
+
for (let i = 0; i < cols; i++) {
|
| 885 |
+
const x = i * fontSize;
|
| 886 |
+
const y = drops[i];
|
| 887 |
+
const ch = pickChar();
|
| 888 |
+
const c = COLORS[(i + Math.floor(y / fontSize)) % COLORS.length];
|
| 889 |
+
|
| 890 |
+
ctx.shadowColor = c;
|
| 891 |
+
ctx.shadowBlur = 10;
|
| 892 |
+
ctx.fillStyle = c;
|
| 893 |
+
ctx.fillText(ch, x, y);
|
| 894 |
+
|
| 895 |
+
// orta hız
|
| 896 |
+
drops[i] += fontSize * (0.9 + Math.random() * 0.5);
|
| 897 |
+
|
| 898 |
+
if (drops[i] > h + 60 && Math.random() > 0.985) {
|
| 899 |
+
drops[i] = -Math.random() * 300;
|
| 900 |
+
}
|
| 901 |
+
}
|
| 902 |
+
requestAnimationFrame(draw);
|
| 903 |
+
};
|
| 904 |
+
|
| 905 |
+
resize();
|
| 906 |
+
window.addEventListener("resize", resize, { passive: true });
|
| 907 |
+
draw();
|
| 908 |
+
};
|
| 909 |
+
|
| 910 |
+
tryInit();
|
| 911 |
+
}
|
| 912 |
+
"""
|
| 913 |
+
|
| 914 |
if __name__ == "__main__":
|
| 915 |
demo.launch()
|
| 916 |
+
demo.load(None, None, None, js=BINARY_JS)
|