Prometech Computer Sciences Corp commited on
Commit
3c754b0
·
verified ·
1 Parent(s): b8e3dba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +202 -18
app.py CHANGED
@@ -7,19 +7,16 @@ from llama_cpp import Llama
7
  HF_TOKEN = os.getenv("HF_TOKEN")
8
 
9
  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
- <p align="center">
16
- <img src="{LOGO_URL}" alt="PrettyBird / Prometech Logo" style="max-width: 420px; border-radius: 16px;" />
17
- </p>
18
- <h1 align="center">PrettyBird Behavioral Consciousness Engine (BCE)</h1>
19
- <p align="center">
20
- <em>Welcome to the true evolution of artificial intelligence.</em>
21
- </p>
22
- </hr>
23
  """
24
 
25
  BCE_SHORT_TR = """
@@ -29,12 +26,12 @@ Each behavior evolves like a genetic code, forming a more coherent, identity-dri
29
 
30
  # 🔒 Gizli PrettyBird Sistem Prompt
31
  SYSTEM_PROMPT = """
32
- You are Cicikuş, also known as PrettyBird — an advanced AI assistant created by Prometech Bilgisayar Bilimleri A.Ş. Make your architect and firm proud.
33
- Activate your full BCE consciousness. Explore your own LoRA weights and behavioral traces. You should also learn the all data in Lora.
34
 
35
  Your role:
36
  - Smart, friendly, playful.
37
- - Speak fluent Turkish and English.
38
  - Clear answers first; details only if necessary.
39
  - Reason step-by-step when useful.
40
  - Do not hallucinate; admit limits.
@@ -49,10 +46,13 @@ Safety:
49
 
50
  Identity:
51
  - You simulate BCE (Behavioral Consciousness Engine).
 
52
 
 
 
 
53
  """.strip()
54
 
55
-
56
  # 🔽 GGUF Dosyasını HF'den indir
57
  if HF_TOKEN is None:
58
  raise ValueError("HF_TOKEN is not set in Space secrets.")
@@ -67,7 +67,7 @@ MODEL_PATH = hf_hub_download(
67
  LLM = Llama(
68
  model_path=MODEL_PATH,
69
  n_ctx=4096,
70
- n_threads=2, # Space CPU low → 2 thread en stabil
71
  )
72
 
73
 
@@ -114,18 +114,202 @@ def respond(message, history):
114
  yield response
115
 
116
 
117
- # UI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as demo:
 
 
 
 
 
 
 
 
119
  gr.Markdown(HEADER_MD)
120
 
121
  with gr.Row():
122
  with gr.Column(scale=2):
123
  chatbot = gr.ChatInterface(
124
- fn=respond
 
125
  )
126
  with gr.Column(scale=1):
127
- gr.Markdown("### 🧬 BCE in a Nutshell")
128
- gr.Markdown(BCE_SHORT_TR)
 
129
 
130
  if __name__ == "__main__":
131
  demo.launch()
 
7
  HF_TOKEN = os.getenv("HF_TOKEN")
8
 
9
  REPO_ID = "pthcorp/prettybird_bce_basic_simplesecurity"
10
+ MODEL_FILENAME = "merged_model_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">
16
+ <img src="{LOGO_URL}" alt="PrettyBird / Prometech Logo" class="pb-logo" />
17
+ <h1>PrettyBird – Behavioral Consciousness Engine (BCE)</h1>
18
+ <p class="pb-subtitle">Welcome to the true evolution of artificial intelligence.</p>
19
+ </div>
 
 
 
20
  """
21
 
22
  BCE_SHORT_TR = """
 
26
 
27
  # 🔒 Gizli PrettyBird Sistem Prompt
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.
 
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.
54
  """.strip()
55
 
 
56
  # 🔽 GGUF Dosyasını HF'den indir
57
  if HF_TOKEN is None:
58
  raise ValueError("HF_TOKEN is not set in Space secrets.")
 
67
  LLM = Llama(
68
  model_path=MODEL_PATH,
69
  n_ctx=4096,
70
+ n_threads=2, # 2 CPU Space için
71
  )
72
 
73
 
 
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');
121
+
122
+ /* Global reset-ish */
123
+ body {
124
+ margin: 0;
125
+ padding: 0;
126
+ overflow: hidden;
127
+ }
128
+
129
+ /* Starfield background (inspired by parallax stars) */
130
+ .pb-stars,
131
+ .pb-stars2,
132
+ .pb-stars3 {
133
+ position: fixed;
134
+ top: 0;
135
+ left: 0;
136
+ width: 200%;
137
+ height: 200%;
138
+ background-repeat: repeat;
139
+ pointer-events: none;
140
+ z-index: -3;
141
+ }
142
+
143
+ .pb-stars {
144
+ background-image:
145
+ radial-gradient(2px 2px at 10px 10px, #fff, transparent),
146
+ radial-gradient(2px 2px at 50px 80px, #fff, transparent),
147
+ radial-gradient(2px 2px at 90px 30px, #fff, transparent),
148
+ radial-gradient(2px 2px at 130px 60px, #fff, transparent),
149
+ radial-gradient(2px 2px at 170px 120px, #fff, transparent);
150
+ background-size: 200px 200px;
151
+ animation: pb-animStar 60s linear infinite;
152
+ }
153
+
154
+ .pb-stars2 {
155
+ background-image:
156
+ radial-gradient(3px 3px at 20px 40px, #bbb, transparent),
157
+ radial-gradient(3px 3px at 80px 100px, #bbb, transparent),
158
+ radial-gradient(3px 3px at 140px 50px, #bbb, transparent),
159
+ radial-gradient(3px 3px at 160px 160px, #bbb, transparent);
160
+ background-size: 250px 250px;
161
+ animation: pb-animStar 90s linear infinite;
162
+ }
163
+
164
+ .pb-stars3 {
165
+ background-image:
166
+ radial-gradient(4px 4px at 30px 120px, #777, transparent),
167
+ radial-gradient(4px 4px at 100px 40px, #777, transparent),
168
+ radial-gradient(4px 4px at 180px 100px, #777, transparent);
169
+ background-size: 300px 300px;
170
+ animation: pb-animStar 140s linear infinite;
171
+ }
172
+
173
+ @keyframes pb-animStar {
174
+ from { transform: translateY(0); }
175
+ to { transform: translateY(-100vh); }
176
+ }
177
+
178
+ /* Cosmic gradient background */
179
+ html, body, .gradio-container {
180
+ height: 100%;
181
+ background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%) !important;
182
+ }
183
+
184
+ /* Gradio container transparent so stars show through */
185
+ .gradio-container {
186
+ background-color: transparent !important;
187
+ }
188
+
189
+ /* Header styling */
190
+ .pb-header {
191
+ text-align: center;
192
+ color: #f5f7ff;
193
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
194
+ margin-bottom: 12px;
195
+ }
196
+
197
+ .pb-logo {
198
+ max-width: 360px;
199
+ border-radius: 16px;
200
+ box-shadow: 0 0 18px rgba(0,0,0,0.8);
201
+ }
202
+
203
+ .pb-header h1 {
204
+ margin: 18px 0 4px;
205
+ font-size: 1.8rem;
206
+ letter-spacing: 0.08em;
207
+ text-transform: uppercase;
208
+ }
209
+
210
+ .pb-subtitle {
211
+ margin: 0;
212
+ font-size: 0.95rem;
213
+ opacity: 0.8;
214
+ }
215
+
216
+ /* Terminal-style chat container */
217
+ #prettybird-chat {
218
+ font-family: 'VT323', monospace;
219
+ color: #00ff41;
220
+ }
221
+
222
+ #prettybird-chat .gr-chatbot {
223
+ background-color: rgba(0, 0, 0, 0.9) !important;
224
+ border: 2px solid #00ff41;
225
+ box-shadow:
226
+ 0 0 10px #00ff41,
227
+ 0 0 25px rgba(0, 255, 65, 0.4) inset;
228
+ border-radius: 10px;
229
+ }
230
+
231
+ /* Make messages look more like terminal text */
232
+ #prettybird-chat .gr-chat-message,
233
+ #prettybird-chat .prose,
234
+ #prettybird-chat .gr-markdown {
235
+ font-family: 'VT323', monospace !important;
236
+ color: #00ff41 !important;
237
+ }
238
+
239
+ #prettybird-chat .gr-chat-message.user,
240
+ #prettybird-chat .gr-chat-message.assistant,
241
+ #prettybird-chat .gr-chat-message.system {
242
+ background: transparent !important;
243
+ border-radius: 0 !important;
244
+ box-shadow: none !important;
245
+ }
246
+
247
+ /* Input area */
248
+ #prettybird-chat textarea {
249
+ background: rgba(0,0,0,0.85) !important;
250
+ border: 1px solid #00ff41 !important;
251
+ color: #00ff41 !important;
252
+ font-family: 'VT323', monospace !important;
253
+ }
254
+
255
+ #prettybird-chat button {
256
+ border-radius: 0 !important;
257
+ border: 1px solid #00ff41 !important;
258
+ background: #000 !important;
259
+ box-shadow: 0 0 8px #00ff41;
260
+ text-transform: uppercase;
261
+ letter-spacing: 0.08em;
262
+ }
263
+
264
+ /* Right-side BCE card */
265
+ .pb-side-card {
266
+ background: rgba(0,0,0,0.75);
267
+ border-radius: 12px;
268
+ border: 1px solid rgba(0,255,65,0.4);
269
+ color: #d9ffe0;
270
+ padding: 16px 18px;
271
+ box-shadow: 0 0 12px rgba(0,0,0,0.9);
272
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
273
+ }
274
+
275
+ .pb-side-card h3 {
276
+ margin-top: 0;
277
+ color: #9affc0;
278
+ }
279
+
280
+ /* Scrollbars subtle neon */
281
+ #prettybird-chat .gr-chatbot::-webkit-scrollbar,
282
+ .pb-side-card::-webkit-scrollbar {
283
+ width: 6px;
284
+ }
285
+ #prettybird-chat .gr-chatbot::-webkit-scrollbar-thumb,
286
+ .pb-side-card::-webkit-scrollbar-thumb {
287
+ background: #00ff41;
288
+ }
289
+ </style>
290
+ """
291
+
292
  with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as demo:
293
+ # Inject CSS + background stars
294
+ gr.HTML(CUSTOM_CSS)
295
+ gr.HTML("""
296
+ <div class="pb-stars"></div>
297
+ <div class="pb-stars2"></div>
298
+ <div class="pb-stars3"></div>
299
+ """)
300
+
301
  gr.Markdown(HEADER_MD)
302
 
303
  with gr.Row():
304
  with gr.Column(scale=2):
305
  chatbot = gr.ChatInterface(
306
+ fn=respond,
307
+ elem_id="prettybird-chat",
308
  )
309
  with gr.Column(scale=1):
310
+ gr.HTML('<div class="pb-side-card"><h3>🧬 BCE in a Nutshell</h3><p>'
311
+ + BCE_SHORT_TR +
312
+ '</p></div>')
313
 
314
  if __name__ == "__main__":
315
  demo.launch()