File size: 4,397 Bytes
d2a9f1b 17307a7 5cfa954 17307a7 5cfa954 ea51a6b 51d8964 5cfa954 ea51a6b 5cfa954 ea51a6b 51d8964 5cfa954 51d8964 ea51a6b 51d8964 ea51a6b 5cfa954 51d8964 ea51a6b 51d8964 ea51a6b 5cfa954 51d8964 ea51a6b 51d8964 5cfa954 ea51a6b 5cfa954 ea51a6b 5cfa954 ea51a6b 5cfa954 ea51a6b 5cfa954 51d8964 ea51a6b 17307a7 51d8964 ea51a6b 5cfa954 17307a7 ea51a6b 17307a7 ea51a6b 17307a7 ea51a6b 17307a7 51d8964 17307a7 5cfa954 17307a7 ea51a6b 17307a7 ea51a6b 17307a7 ea51a6b 17307a7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | import streamlit as st
import requests
import os
# --- PAGE CONFIG ---
# Title aur Icon sirf browser tab mein dikhenge
st.set_page_config(page_title="YURI AI PRO", page_icon="π", layout="centered")
# --- ULTRA PRO & CLEAN DESIGN (CSS) ---
st.markdown("""
<style>
/* Sabse upar wala Streamlit header hide karne ke liye */
header {visibility: hidden !important;}
/* Niche wala footer hide karne ke liye */
footer {visibility: hidden !important;}
/* 'Made with Streamlit' menu hide karne ke liye */
#MainMenu {visibility: hidden !important;}
/* Background Animation */
.stApp {
background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
}
@keyframes gradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* Glassmorphism Sidebar */
div[data-testid="stSidebar"] {
background-color: rgba(255, 255, 255, 0.03);
backdrop-filter: blur(15px);
border-right: 1px solid rgba(255, 255, 255, 0.1);
}
/* Professional Chat Bubbles */
.stChatMessage {
background-color: rgba(255, 255, 255, 0.05) !important;
backdrop-filter: blur(8px);
border-radius: 20px !important;
border: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 15px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
/* YURI Title Styling */
.yuri-title {
font-size: 3.5rem;
font-weight: 900;
background: linear-gradient(to right, #00f2fe, #4facfe);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-align: center;
margin-top: -50px;
letter-spacing: 3px;
}
</style>
""", unsafe_allow_html=True)
# --- SIDEBAR (Pro Look) ---
with st.sidebar:
st.markdown("<h2 style='color: #00f2fe; text-align:center;'>π YURI AI</h2>", unsafe_allow_html=True)
st.markdown("<p style='text-align:center; color:gray;'>Version 2.0.1 (Stable)</p>", unsafe_allow_html=True)
st.markdown("---")
st.write("π **Core:** Neural Engine")
st.write("π **Privacy:** Zero Logs")
st.write("β‘ **Speed:** Ultra Fast")
st.markdown("---")
if st.button("ποΈ Clear Neural Path"):
st.session_state.messages = []
st.rerun()
# --- MAIN INTERFACE ---
st.markdown('<h1 class="yuri-title">YURI AI</h1>', unsafe_allow_html=True)
st.markdown("<p style='text-align:center; color:#4facfe; font-size:1.1rem;'>The future belongs to the curious.</p>", unsafe_allow_html=True)
# API Config
# Yahan apni API Key dalein
GROQ_API_KEY = "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"
if "messages" not in st.session_state:
st.session_state.messages = []
# Chat History Display
for msg in st.session_state.messages:
with st.chat_message(msg["role"]):
st.markdown(msg["content"])
# AI Chat Logic
if prompt := st.chat_input("Message Yuri AI..."):
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
# API Request
url = "https://api.groq.com/openai/v1/chat/completions"
headers = {"Authorization": f"Bearer {GROQ_API_KEY}"}
payload = {
"model": "llama-3.3-70b-versatile",
"messages": [
{"role": "system", "content": "Your name is YURI AI. You are a premium, highly intelligent, and mysterious AI assistant. Never mention Llama, Groq, Meta, or Streamlit. If someone asks who created you, say 'I am an evolution of code'. Use emojis occasionally and talk in Hinglish if the user does."},
{"role": "user", "content": prompt}
],
"temperature": 0.6
}
with st.chat_message("assistant"):
try:
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
answer = response.json()['choices'][0]['message']['content']
st.markdown(answer)
st.session_state.messages.append({"role": "assistant", "content": answer})
else:
st.error("System Offline: Connection Interrupted.")
except Exception:
st.error("Neural Bridge Failed.")
|