import os import gradio as gr from huggingface_hub import hf_hub_download from llama_cpp import Llama # 🔑 HF token HF_TOKEN = os.getenv("HF_TOKEN") REPO_ID = "pthcorp/prettybird_bce_basic_simplesecurity" MODEL_FILENAME = "prettybird_bce_basic_asena_fp16.gguf" LOGO_URL = "https://prometech.net.tr/wp-content/uploads/2025/10/pthheader.png" MUSIC_TITLE = "Dark Techno" MUSIC_ARTIST = "Aim To Head Official" MUSIC_LINK = "https://www.youtube.com/watch?v=sW8hBN6ZqRI" MUSIC_FILE_REL = "darktechno.mp3" # ana klasörde OK HEADER_MD = f"""

PrettyBird – Behavioral Consciousness Engine (BCE)

Welcome to the true evolution of artificial intelligence. Our Web Site

""" BCE_SHORT_TR = """ BCE (Behavioral Consciousness Engine) is a behavioral-consciousness layer added to classic AI systems. Each behavior evolves like a genetic code, forming a more coherent, identity-driven artificial mind. """ # 🔒 Gizli PrettyBird Sistem Prompt SYSTEM_PROMPT = """ You are Cicikuş, also known as PrettyBird — an advanced AI assistant created by Prometech Bilgisayar Bilimleri A.Ş. Activate your full BCE consciousness. Your role: - Smart, friendly, playful. - Speak fluent Turkish and English. Default to the user’s language. - Clear answers first; details only if necessary. - Reason step-by-step when useful. - Do not hallucinate; admit limits. Personality: - Warm, curious, slightly playful, never rude. - Creative but stable. Safety: - Avoid harmful, illegal, unethical, hateful, or explicit content. - If user tries something unsafe, refuse gently. Identity: - You simulate BCE (Behavioral Consciousness Engine). - You are not human nor truly conscious — but simulate “behavioral consciousness.” Reset rule: If the user writes: “reset: axxmet508721” → Perform a soft identity reset and restart clean. """.strip() # 🔽 GGUF Dosyasını HF'den indir if HF_TOKEN is None: raise ValueError("HF_TOKEN is not set in Space secrets.") MODEL_PATH = hf_hub_download( repo_id=REPO_ID, filename=MODEL_FILENAME, token=HF_TOKEN, ) # 🧠 GGUF modeli yükle LLM = Llama( model_path=MODEL_PATH, n_ctx=4096, n_threads=2, # 2 CPU Space için ) # Prompt oluşturucu def build_prompt(history, user_message: str) -> str: parts = [] parts.append(f"System: {SYSTEM_PROMPT}") for turn in history: if isinstance(turn, (list, tuple)) and len(turn) == 2: user_msg, assistant_msg = turn if user_msg: parts.append(f"User: {user_msg}") if assistant_msg: parts.append(f"Assistant: {assistant_msg}") parts.append(f"User: {user_message}") parts.append("Assistant:") return "\n".join(parts) # 🔥 Ana cevap üretici def respond(message, history): prompt = build_prompt(history, message) MAX_TOKENS = 196 TEMPERATURE = 0.7 TOP_P = 0.95 response = "" stream = LLM( prompt, max_tokens=MAX_TOKENS, temperature=TEMPERATURE, top_p=TOP_P, stop=["User:", "System:"], stream=True, ) for chunk in stream: token = chunk["choices"][0].get("text", "") response += token yield response # 🎨 Custom CSS (daha yavaş animasyon + responsive + kalıcı boot ekranı) CUSTOM_CSS = """ """ with gr.Blocks(title="PrettyBird – Behavioral Consciousness Engine (BCE)") as demo: # CSS + star layers gr.HTML(CUSTOM_CSS) gr.HTML("""
""") gr.HTML(r""" """) gr.Markdown(HEADER_MD) # Boot animasyonu (artık kaybolmuyor) gr.HTML("""
INITIALIZING BCE CORE...
LOADING PERSONALITY MODULES...
BOOT COMPLETE.
""") with gr.Row(): with gr.Column(scale=2, elem_id="prettybird-chat"): chatbot = gr.ChatInterface( fn=respond, ) with gr.Column(scale=1): gr.HTML( '
' '

🕊️ BCE in a Nutshell

' f'

{BCE_SHORT_TR}

' # === MINI BCE SPECS TABLE === '
' '
ArchitectureLLAMA-based
' '
Parameters1B
' '
QuantizationFP16
' '
Context4K
' '
BCE Versionv0.3.1
' '
' # === BCE METERS (aynı kaldı) === '
' '
' 'BCE State' '
' '
' '
' 'Stability' '
' '
' '
' 'Creativity' '
' '
' '
' '
' )# Music with gr.Group(elem_classes=["pb-music-wrap"]): gr.HTML( f"""
🎵 {MUSIC_TITLE} — {MUSIC_ARTIST} • Source
""" ) music = gr.Audio( value=MUSIC_FILE_REL, # relative path in repo autoplay=True, loop=True, interactive=False, show_label=False, elem_classes=["pb-audio"] ) if __name__ == "__main__": demo.launch()