guide / app.py
HyperMehfin's picture
Update app.py
5cb4023 verified
import streamlit as st
import difflib
from data import kb as techfest_data
# --- PAGE CONFIGURATION ---
st.set_page_config(
page_title="VEDANIX 2K26",
page_icon="✨",
layout="centered"
)
# --- LUXURY UI (CSS) ---
st.markdown("""
<style>
/* 1. HIDE DEFAULT STREAMLIT ELEMENTS */
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
/* 2. MAIN BACKGROUND - Deep Royal Navy Gradient */
.stApp {
background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
color: #ffffff;
}
/* 3. CHAT BUBBLES - GLASSMORPHISM EFFECT */
/* Assistant (Gold Border + Dark Glass) */
.stChatMessage[data-testid="stChatMessage"]:nth-child(odd) {
background: rgba(30, 40, 50, 0.7); /* Transparent Dark Blue */
backdrop-filter: blur(10px); /* Frosted Glass */
border: 1px solid #FFD700 !important; /* PURE GOLD BORDER */
border-radius: 15px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
/* User (Subtle Glass) */
.stChatMessage[data-testid="stChatMessage"]:nth-child(even) {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(5px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 15px;
}
/* 4. TITLE - FORCED GOLD & GLOW */
/* We use a specific class to ensure it doesn't turn white */
.vedanix-title {
color: #FFD700 !important; /* Force Gold Color */
text-align: center;
font-family: 'Helvetica Neue', sans-serif;
font-weight: 100;
letter-spacing: 8px;
text-transform: uppercase;
font-size: 3.5rem;
margin-bottom: 0px;
text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); /* Gold Glow */
}
.vedanix-subtitle {
text-align: center;
color: #8fa3bf !important;
font-size: 1rem;
font-weight: 300;
letter-spacing: 2px;
margin-top: -10px;
margin-bottom: 40px;
text-transform: uppercase;
}
/* 5. LINKS & INTERACTION */
a {
color: #00e5ff !important; /* Cyan for visibility */
text-decoration: none;
font-weight: bold;
transition: 0.3s;
}
a:hover {
text-shadow: 0 0 10px #00e5ff;
}
/* 6. INPUT BOX STYLING */
.stChatInputContainer {
padding-bottom: 20px;
}
div[data-testid="stChatInput"] {
border-radius: 20px;
border: 1px solid #444;
background-color: rgba(20, 20, 20, 0.8);
}
</style>
""", unsafe_allow_html=True)
# --- LOGIC FUNCTION ---
def get_bot_response(user_input):
user_input = user_input.lower()
best_match_key = None
highest_score = 0
for key, data in techfest_data.items():
for keyword in data["keywords"]:
if keyword in user_input:
return data["response"]
# Fuzzy match
similarity = difflib.SequenceMatcher(None, keyword, user_input).ratio()
if similarity > 0.6 and similarity > highest_score:
highest_score = similarity
best_match_key = key
if best_match_key and highest_score > 0.6:
return techfest_data[best_match_key]["response"]
return "🤖 I apologize. I can help with **Schedule**, **Rooms**, **Gaming**, or **Stalls**. Please try a keyword!"
# --- MAIN APPLICATION ---
def main():
# CUSTOM HTML HEADER (To guarantee Gold Color)
st.markdown('<h1 class="vedanix-title">VEDANIX</h1>', unsafe_allow_html=True)
st.markdown('<div class="vedanix-subtitle">Official AI Companion • 2K26</div>', unsafe_allow_html=True)
# Chat History
if "messages" not in st.session_state:
st.session_state.messages = [
{"role": "assistant", "content": "✨ **Welcome to VEDANIX.**\n\nI am your event guide. Locate any room, schedule, or event instantly."}
]
# Display Messages
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
# Input Area
if prompt := st.chat_input("Ask about Schedule, Location, or Gaming..."):
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
response = get_bot_response(prompt)
with st.chat_message("assistant"):
st.markdown(response)
st.session_state.messages.append({"role": "assistant", "content": response})
if __name__ == "__main__":
main()