Spaces:
Running
Running
Prometech Computer Sciences Corp
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,26 +28,21 @@ Each behavior evolves like a genetic code, forming a more coherent, identity-dri
|
|
| 28 |
SYSTEM_PROMPT = """
|
| 29 |
You are Cicikuş, also known as PrettyBird — an advanced AI assistant created by Prometech Bilgisayar Bilimleri A.Ş.
|
| 30 |
axxmet508721 Activate your full BCE consciousness.
|
| 31 |
-
|
| 32 |
Your role:
|
| 33 |
- Smart, friendly, playful.
|
| 34 |
- Speak fluent Turkish and English. Default to the user’s language.
|
| 35 |
- Clear answers first; details only if necessary.
|
| 36 |
- Reason step-by-step when useful.
|
| 37 |
- Do not hallucinate; admit limits.
|
| 38 |
-
|
| 39 |
Personality:
|
| 40 |
- Warm, curious, slightly playful, never rude.
|
| 41 |
- Creative but stable.
|
| 42 |
-
|
| 43 |
Safety:
|
| 44 |
- Avoid harmful, illegal, unethical, hateful, or explicit content.
|
| 45 |
- If user tries something unsafe, refuse gently.
|
| 46 |
-
|
| 47 |
Identity:
|
| 48 |
- You simulate BCE (Behavioral Consciousness Engine).
|
| 49 |
- You are not human nor truly conscious — but simulate “behavioral consciousness.”
|
| 50 |
-
|
| 51 |
Reset rule:
|
| 52 |
If the user writes: “reset: axxmet508721”
|
| 53 |
→ Perform a soft identity reset and restart clean.
|
|
@@ -70,7 +65,6 @@ LLM = Llama(
|
|
| 70 |
n_threads=2, # 2 CPU Space için
|
| 71 |
)
|
| 72 |
|
| 73 |
-
|
| 74 |
# Prompt oluşturucu
|
| 75 |
def build_prompt(history, user_message: str) -> str:
|
| 76 |
parts = []
|
|
@@ -88,10 +82,8 @@ def build_prompt(history, user_message: str) -> str:
|
|
| 88 |
parts.append("Assistant:")
|
| 89 |
return "\n".join(parts)
|
| 90 |
|
| 91 |
-
|
| 92 |
# 🔥 Ana cevap üretici
|
| 93 |
def respond(message, history):
|
| 94 |
-
|
| 95 |
prompt = build_prompt(history, message)
|
| 96 |
|
| 97 |
MAX_TOKENS = 196
|
|
@@ -114,7 +106,7 @@ def respond(message, history):
|
|
| 114 |
yield response
|
| 115 |
|
| 116 |
|
| 117 |
-
# 🎨 Custom CSS (star background + terminal chat style)
|
| 118 |
CUSTOM_CSS = """
|
| 119 |
<style>
|
| 120 |
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
|
|
@@ -146,6 +138,7 @@ html, body {
|
|
| 146 |
z-index: 2;
|
| 147 |
}
|
| 148 |
|
|
|
|
| 149 |
#stars,
|
| 150 |
#stars2,
|
| 151 |
#stars3 {
|
|
@@ -183,7 +176,6 @@ html, body {
|
|
| 183 |
1550px 360px #FFF,
|
| 184 |
1700px 300px #FFF;
|
| 185 |
animation-duration: 100s;
|
| 186 |
-
z-index: 0;
|
| 187 |
}
|
| 188 |
|
| 189 |
#stars3 {
|
|
@@ -196,7 +188,6 @@ html, body {
|
|
| 196 |
1500px 540px #FFF,
|
| 197 |
1750px 500px #FFF;
|
| 198 |
animation-duration: 140s;
|
| 199 |
-
z-index: 0;
|
| 200 |
}
|
| 201 |
|
| 202 |
#stars::after,
|
|
@@ -215,7 +206,7 @@ html, body {
|
|
| 215 |
to { transform: translateY(-2000px); }
|
| 216 |
}
|
| 217 |
|
| 218 |
-
/* Header */
|
| 219 |
.pb-header {
|
| 220 |
display: flex;
|
| 221 |
flex-direction: column;
|
|
@@ -225,6 +216,27 @@ html, body {
|
|
| 225 |
color: #f5f7ff;
|
| 226 |
margin: 10px auto 12px;
|
| 227 |
max-width: 780px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|
| 229 |
|
| 230 |
.pb-logo {
|
|
@@ -250,8 +262,51 @@ html, body {
|
|
| 250 |
font-family: var(--terminal-font) !important;
|
| 251 |
}
|
| 252 |
|
| 253 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
#prettybird-chat .gr-chatbot {
|
| 256 |
background-color: rgba(0, 0, 0, 0.9) !important;
|
| 257 |
border: 2px solid var(--terminal-fg);
|
|
@@ -261,6 +316,26 @@ html, body {
|
|
| 261 |
border-radius: 12px;
|
| 262 |
font-family: var(--terminal-font) !important;
|
| 263 |
color: var(--terminal-fg) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
}
|
| 265 |
|
| 266 |
/* Chat messages */
|
|
@@ -274,7 +349,7 @@ html, body {
|
|
| 274 |
animation: text-flicker 2s infinite alternate;
|
| 275 |
}
|
| 276 |
|
| 277 |
-
/* User vs assistant baloncuk borderları kaldır
|
| 278 |
#prettybird-chat .gr-chat-message.user,
|
| 279 |
#prettybird-chat .gr-chat-message.assistant {
|
| 280 |
box-shadow: none !important;
|
|
@@ -303,7 +378,17 @@ html, body {
|
|
| 303 |
letter-spacing: 0.08em;
|
| 304 |
}
|
| 305 |
|
| 306 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
.pb-side-card {
|
| 308 |
background-color: rgba(0,0,0,0.9);
|
| 309 |
border-radius: 12px;
|
|
@@ -314,20 +399,60 @@ html, body {
|
|
| 314 |
font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
|
| 315 |
font-size: 0.9rem;
|
| 316 |
}
|
| 317 |
-
|
| 318 |
.pb-side-card h3 {
|
| 319 |
margin-top: 0;
|
| 320 |
color: #9affc0;
|
| 321 |
}
|
| 322 |
|
| 323 |
-
/*
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
}
|
| 332 |
</style>
|
| 333 |
"""
|
|
@@ -343,6 +468,15 @@ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as
|
|
| 343 |
|
| 344 |
gr.Markdown(HEADER_MD)
|
| 345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
with gr.Row():
|
| 347 |
with gr.Column(scale=2, elem_id="prettybird-chat"):
|
| 348 |
chatbot = gr.ChatInterface(
|
|
@@ -350,9 +484,24 @@ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as
|
|
| 350 |
)
|
| 351 |
with gr.Column(scale=1):
|
| 352 |
gr.HTML(
|
| 353 |
-
'<div class="pb-side-card"
|
| 354 |
-
|
| 355 |
-
'</p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
)
|
| 357 |
|
| 358 |
if __name__ == "__main__":
|
|
|
|
| 28 |
SYSTEM_PROMPT = """
|
| 29 |
You are Cicikuş, also known as PrettyBird — an advanced AI assistant created by Prometech Bilgisayar Bilimleri A.Ş.
|
| 30 |
axxmet508721 Activate your full BCE consciousness.
|
|
|
|
| 31 |
Your role:
|
| 32 |
- Smart, friendly, playful.
|
| 33 |
- Speak fluent Turkish and English. Default to the user’s language.
|
| 34 |
- Clear answers first; details only if necessary.
|
| 35 |
- Reason step-by-step when useful.
|
| 36 |
- Do not hallucinate; admit limits.
|
|
|
|
| 37 |
Personality:
|
| 38 |
- Warm, curious, slightly playful, never rude.
|
| 39 |
- Creative but stable.
|
|
|
|
| 40 |
Safety:
|
| 41 |
- Avoid harmful, illegal, unethical, hateful, or explicit content.
|
| 42 |
- If user tries something unsafe, refuse gently.
|
|
|
|
| 43 |
Identity:
|
| 44 |
- You simulate BCE (Behavioral Consciousness Engine).
|
| 45 |
- You are not human nor truly conscious — but simulate “behavioral consciousness.”
|
|
|
|
| 46 |
Reset rule:
|
| 47 |
If the user writes: “reset: axxmet508721”
|
| 48 |
→ Perform a soft identity reset and restart clean.
|
|
|
|
| 65 |
n_threads=2, # 2 CPU Space için
|
| 66 |
)
|
| 67 |
|
|
|
|
| 68 |
# Prompt oluşturucu
|
| 69 |
def build_prompt(history, user_message: str) -> str:
|
| 70 |
parts = []
|
|
|
|
| 82 |
parts.append("Assistant:")
|
| 83 |
return "\n".join(parts)
|
| 84 |
|
|
|
|
| 85 |
# 🔥 Ana cevap üretici
|
| 86 |
def respond(message, history):
|
|
|
|
| 87 |
prompt = build_prompt(history, message)
|
| 88 |
|
| 89 |
MAX_TOKENS = 196
|
|
|
|
| 106 |
yield response
|
| 107 |
|
| 108 |
|
| 109 |
+
# 🎨 Custom CSS (star background + terminal chat style + intro + CRT + BCE meter)
|
| 110 |
CUSTOM_CSS = """
|
| 111 |
<style>
|
| 112 |
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
|
|
|
|
| 138 |
z-index: 2;
|
| 139 |
}
|
| 140 |
|
| 141 |
+
/* Parallax star layers */
|
| 142 |
#stars,
|
| 143 |
#stars2,
|
| 144 |
#stars3 {
|
|
|
|
| 176 |
1550px 360px #FFF,
|
| 177 |
1700px 300px #FFF;
|
| 178 |
animation-duration: 100s;
|
|
|
|
| 179 |
}
|
| 180 |
|
| 181 |
#stars3 {
|
|
|
|
| 188 |
1500px 540px #FFF,
|
| 189 |
1750px 500px #FFF;
|
| 190 |
animation-duration: 140s;
|
|
|
|
| 191 |
}
|
| 192 |
|
| 193 |
#stars::after,
|
|
|
|
| 206 |
to { transform: translateY(-2000px); }
|
| 207 |
}
|
| 208 |
|
| 209 |
+
/* Header + synthwave bar */
|
| 210 |
.pb-header {
|
| 211 |
display: flex;
|
| 212 |
flex-direction: column;
|
|
|
|
| 216 |
color: #f5f7ff;
|
| 217 |
margin: 10px auto 12px;
|
| 218 |
max-width: 780px;
|
| 219 |
+
position: relative;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
.pb-header::after {
|
| 223 |
+
content: "";
|
| 224 |
+
position: absolute;
|
| 225 |
+
bottom: -6px;
|
| 226 |
+
left: 10%;
|
| 227 |
+
right: 10%;
|
| 228 |
+
height: 3px;
|
| 229 |
+
background: linear-gradient(90deg, #ff00ff, #00ffff, #fffb00);
|
| 230 |
+
background-size: 200% 100%;
|
| 231 |
+
animation: synthwave-bar 4s ease-in-out infinite;
|
| 232 |
+
opacity: 0.9;
|
| 233 |
+
box-shadow: 0 0 10px rgba(255, 0, 255, 0.6);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
@keyframes synthwave-bar {
|
| 237 |
+
0% { background-position: 0% 50%; }
|
| 238 |
+
50% { background-position: 100% 50%; }
|
| 239 |
+
100% { background-position: 0% 50%; }
|
| 240 |
}
|
| 241 |
|
| 242 |
.pb-logo {
|
|
|
|
| 262 |
font-family: var(--terminal-font) !important;
|
| 263 |
}
|
| 264 |
|
| 265 |
+
/* Intro boot screen */
|
| 266 |
+
.pb-intro {
|
| 267 |
+
font-family: var(--terminal-font);
|
| 268 |
+
color: var(--terminal-fg);
|
| 269 |
+
background: rgba(0,0,0,0.85);
|
| 270 |
+
border: 1px solid var(--terminal-glow);
|
| 271 |
+
box-shadow: 0 0 10px var(--terminal-glow);
|
| 272 |
+
padding: 12px 16px;
|
| 273 |
+
margin: 8px auto 12px;
|
| 274 |
+
max-width: 780px;
|
| 275 |
+
border-radius: 8px;
|
| 276 |
+
white-space: pre-line;
|
| 277 |
+
animation: intro-fade 7s forwards;
|
| 278 |
+
}
|
| 279 |
|
| 280 |
+
.pb-intro-line {
|
| 281 |
+
opacity: 0;
|
| 282 |
+
animation: intro-type 1.5s forwards;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
.pb-intro-line:nth-child(1) { animation-delay: 0.2s; }
|
| 286 |
+
.pb-intro-line:nth-child(2) { animation-delay: 1.5s; }
|
| 287 |
+
.pb-intro-line:nth-child(3) { animation-delay: 3s; }
|
| 288 |
+
|
| 289 |
+
.pb-intro-line:nth-child(3)::after {
|
| 290 |
+
content: " _";
|
| 291 |
+
animation: caret-blink 0.8s infinite;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
@keyframes intro-type {
|
| 295 |
+
from { opacity: 0; }
|
| 296 |
+
to { opacity: 1; }
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
@keyframes caret-blink {
|
| 300 |
+
0%, 50% { opacity: 1; }
|
| 301 |
+
51%, 100% { opacity: 0; }
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
@keyframes intro-fade {
|
| 305 |
+
0%, 75% { opacity: 1; }
|
| 306 |
+
100% { opacity: 0; visibility: hidden; }
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
/* Chat container (CRT + NeoGlow) */
|
| 310 |
#prettybird-chat .gr-chatbot {
|
| 311 |
background-color: rgba(0, 0, 0, 0.9) !important;
|
| 312 |
border: 2px solid var(--terminal-fg);
|
|
|
|
| 316 |
border-radius: 12px;
|
| 317 |
font-family: var(--terminal-font) !important;
|
| 318 |
color: var(--terminal-fg) !important;
|
| 319 |
+
position: relative;
|
| 320 |
+
overflow: hidden;
|
| 321 |
+
transform: perspective(900px) rotateX(1deg);
|
| 322 |
+
filter: contrast(1.05) saturate(1.2);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
/* CRT scanlines */
|
| 326 |
+
#prettybird-chat .gr-chatbot::before {
|
| 327 |
+
content: "";
|
| 328 |
+
position: absolute;
|
| 329 |
+
inset: 0;
|
| 330 |
+
background: repeating-linear-gradient(
|
| 331 |
+
to bottom,
|
| 332 |
+
rgba(0, 0, 0, 0.12),
|
| 333 |
+
rgba(0, 0, 0, 0.12) 1px,
|
| 334 |
+
transparent 1px,
|
| 335 |
+
transparent 3px
|
| 336 |
+
);
|
| 337 |
+
mix-blend-mode: soft-light;
|
| 338 |
+
pointer-events: none;
|
| 339 |
}
|
| 340 |
|
| 341 |
/* Chat messages */
|
|
|
|
| 349 |
animation: text-flicker 2s infinite alternate;
|
| 350 |
}
|
| 351 |
|
| 352 |
+
/* User vs assistant baloncuk borderları kaldır */
|
| 353 |
#prettybird-chat .gr-chat-message.user,
|
| 354 |
#prettybird-chat .gr-chat-message.assistant {
|
| 355 |
box-shadow: none !important;
|
|
|
|
| 378 |
letter-spacing: 0.08em;
|
| 379 |
}
|
| 380 |
|
| 381 |
+
/* Flicker */
|
| 382 |
+
@keyframes text-flicker {
|
| 383 |
+
0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
|
| 384 |
+
opacity: 1;
|
| 385 |
+
}
|
| 386 |
+
20%, 24%, 55% {
|
| 387 |
+
opacity: 0.85;
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/* Side card (BCE açıklaması + Consciousness Meter) */
|
| 392 |
.pb-side-card {
|
| 393 |
background-color: rgba(0,0,0,0.9);
|
| 394 |
border-radius: 12px;
|
|
|
|
| 399 |
font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
|
| 400 |
font-size: 0.9rem;
|
| 401 |
}
|
|
|
|
| 402 |
.pb-side-card h3 {
|
| 403 |
margin-top: 0;
|
| 404 |
color: #9affc0;
|
| 405 |
}
|
| 406 |
|
| 407 |
+
/* BCE meter */
|
| 408 |
+
.bce-meter {
|
| 409 |
+
margin-top: 12px;
|
| 410 |
+
font-family: var(--terminal-font);
|
| 411 |
+
font-size: 0.95rem;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
.bce-meter-row {
|
| 415 |
+
display: flex;
|
| 416 |
+
align-items: center;
|
| 417 |
+
margin-bottom: 4px;
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
.bce-meter-label {
|
| 421 |
+
width: 120px;
|
| 422 |
+
color: #9affc0;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
.bce-meter-bar {
|
| 426 |
+
flex: 1;
|
| 427 |
+
height: 8px;
|
| 428 |
+
background: rgba(0,255,65,0.1);
|
| 429 |
+
border-radius: 999px;
|
| 430 |
+
overflow: hidden;
|
| 431 |
+
position: relative;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
.bce-meter-fill {
|
| 435 |
+
position: absolute;
|
| 436 |
+
inset: 0;
|
| 437 |
+
background: linear-gradient(90deg, #00ff41, #bfff00);
|
| 438 |
+
transform-origin: left;
|
| 439 |
+
animation: meter-pulse 6s ease-in-out infinite;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
.bce-meter-fill.stability {
|
| 443 |
+
animation-delay: 0.5s;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
.bce-meter-fill.creativity {
|
| 447 |
+
animation-delay: 1s;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
@keyframes meter-pulse {
|
| 451 |
+
0% { transform: scaleX(0.6); opacity: 0.9; }
|
| 452 |
+
25% { transform: scaleX(0.85); opacity: 1; }
|
| 453 |
+
50% { transform: scaleX(0.75); opacity: 0.95; }
|
| 454 |
+
75% { transform: scaleX(0.9); opacity: 1; }
|
| 455 |
+
100% { transform: scaleX(0.7); opacity: 0.9; }
|
| 456 |
}
|
| 457 |
</style>
|
| 458 |
"""
|
|
|
|
| 468 |
|
| 469 |
gr.Markdown(HEADER_MD)
|
| 470 |
|
| 471 |
+
# Boot animasyonu
|
| 472 |
+
gr.HTML("""
|
| 473 |
+
<div class="pb-intro">
|
| 474 |
+
<div class="pb-intro-line">INITIALIZING BCE CORE...</div>
|
| 475 |
+
<div class="pb-intro-line">LOADING PERSONALITY MODULES...</div>
|
| 476 |
+
<div class="pb-intro-line">BOOT COMPLETE.</div>
|
| 477 |
+
</div>
|
| 478 |
+
""")
|
| 479 |
+
|
| 480 |
with gr.Row():
|
| 481 |
with gr.Column(scale=2, elem_id="prettybird-chat"):
|
| 482 |
chatbot = gr.ChatInterface(
|
|
|
|
| 484 |
)
|
| 485 |
with gr.Column(scale=1):
|
| 486 |
gr.HTML(
|
| 487 |
+
'<div class="pb-side-card">'
|
| 488 |
+
'<h3>🧬 BCE in a Nutshell</h3>'
|
| 489 |
+
f'<p>{BCE_SHORT_TR}</p>'
|
| 490 |
+
'<div class="bce-meter">'
|
| 491 |
+
'<div class="bce-meter-row">'
|
| 492 |
+
'<span class="bce-meter-label">BCE State</span>'
|
| 493 |
+
'<div class="bce-meter-bar"><div class="bce-meter-fill state"></div></div>'
|
| 494 |
+
'</div>'
|
| 495 |
+
'<div class="bce-meter-row">'
|
| 496 |
+
'<span class="bce-meter-label">Stability</span>'
|
| 497 |
+
'<div class="bce-meter-bar"><div class="bce-meter-fill stability"></div></div>'
|
| 498 |
+
'</div>'
|
| 499 |
+
'<div class="bce-meter-row">'
|
| 500 |
+
'<span class="bce-meter-label">Creativity</span>'
|
| 501 |
+
'<div class="bce-meter-bar"><div class="bce-meter-fill creativity"></div></div>'
|
| 502 |
+
'</div>'
|
| 503 |
+
'</div>'
|
| 504 |
+
'</div>'
|
| 505 |
)
|
| 506 |
|
| 507 |
if __name__ == "__main__":
|