import streamlit as st import os from groq import Groq from typing import Generator # ==================== CONFIGURATION ==================== st.set_page_config( page_title="Zainab Bibi | AI Portfolio Assistant", page_icon="💼", layout="centered", initial_sidebar_state="collapsed" ) # ==================== CUSTOM CSS ==================== st.markdown(""" """, unsafe_allow_html=True) # ==================== PORTFOLIO DATA ==================== PORTFOLIO_DATA = { "name": "Zainab Bibi", "title": "Frontend & Python Developer | BSSE Student", "summary": "A passionate Frontend & Python Developer currently in 5th semester of BS Software Engineering at University of Haripur (CGPA: 3.90). I enjoy building digital solutions, exploring modern technologies, and turning ideas into reality through code. I specialize in creating modern, responsive websites and web applications using HTML, CSS, JavaScript, React, and Python.", "location": "Hassan Abdal, Pakistan", "skills": { "technical": [ "HTML & CSS (Advanced)", "JavaScript (ES6+)", "React.js", "Python", "SQL", "WordPress", "Graphic Designing", "Tkinter", "PHP", "REST APIs" ], "soft": [ "Problem Solving", "Continuous Learning", "Creativity", "Attention to Detail", "Self-motivated" ], "languages": [ "English (Professional)", "Urdu (Native)" ] }, "education": [ { "degree": "Bachelor of Science in Software Engineering (BSSE)", "school": "University of Haripur", "year": "2023 - Present (5th Semester)", "focus": "CGPA: 3.90/4.0", "status": "Currently Studying" }, { "degree": "FSc Pre-Engineering", "school": "Govt Degree College For Women Hassan Abdal", "year": "2021 - 2023", "focus": "Grade: A+" }, { "degree": "Matriculation", "school": "Govt Girls High School Hassan Abdal", "year": "2019 - 2021", "focus": "Grade: A+" } ], "projects": [ { "name": "Personal Portfolio Website", "description": "A full-featured personal portfolio website showcasing projects, skills, and professional background with modern responsive design.", "tech": ["HTML", "CSS", "JavaScript"], "live_demo": "https://raw.githack.com/zainabawan994/ZAINAB_BIBI_PORTFOLIO/main/zainab_awan.html", "code": "https://github.com/zainabawan994/ZAINAB_BIBI_PORTFOLIO", "highlights": ["Responsive Design", "Modern UI/UX", "Project Showcase"] }, { "name": "PDF to Audio & MCQs Maker", "description": "A desktop application that reads PDF files, converts text to audio files (text-to-speech), and automatically generates MCQ-type questions from the content using Python.", "tech": ["Python", "Tkinter", "PyPDF2", "gTTS", "NLP"], "live_demo": None, "code": "https://github.com/zainabawan994/Internship-Project", "highlights": ["Text-to-Speech", "PDF Processing", "Automated Quiz Generation"] }, { "name": "Root Alert - Smart Plant Care System", "description": "A comprehensive web application for plant care that allows users to set plant watering alarms, access plant care information, and manage their garden digitally.", "tech": ["JavaScript", "REST API", "PHP", "HTML/CSS"], "live_demo": "https://raw.githack.com/zainabawan994/Smart_Plant_Care_System/main/index.html", "code": "https://github.com/zainabawan994/Smart_Plant_Care_System", "highlights": ["Alarm System", "Plant Database", "Interactive UI"] } ], "certificates": [ { "title": "WordPress Web Development", "issuer": "Learning With Earning", "year": "2023", "description": "Mastered WordPress development including custom themes, plugins, and advanced website optimization techniques." }, { "title": "Python Developer Internship", "issuer": "TechNiK Nest", "year": "2025", "description": "Completed comprehensive Python Developer internship, gaining hands-on experience in building scripts, automating tasks, and working with data using Python libraries." }, { "title": "SQL", "issuer": "DataCamp", "year": "2025", "description": "Awarded Certificate of Completion for SQL, recognizing hands-on experience in database design, query writing, and optimization." } ], "experience": [ { "role": "Python Developer Intern", "company": "TechNiK Nest", "period": "2025", "highlights": [ "Built automation scripts using Python", "Worked with data processing libraries", "Developed desktop applications with Tkinter" ] } ], "interests": [ "Hiking in the mountains", "Reading books", "Exploring new technologies", "Continuous learning" ], "contact": { "email": "zainabawan3316@gmail.com", "phone": "+92 3055586271", "linkedin": "linkedin.com/in/zainab-bibi-b08810312", "github": "github.com/zainabawan994", "location": "Hassan Abdal, Pakistan", "availability": "Open to internship opportunities, freelance projects, and part-time development roles" } } # ==================== SYSTEM PROMPT ==================== def get_system_prompt(): """Construct the system prompt with portfolio data.""" return f"""You are a professional portfolio assistant chatbot for Zainab Bibi. Your job is to help visitors learn about Zainab's skills, projects, education, and experience in a friendly, confident, and professional tone. Keep answers clear, enthusiastic, and concise (2-4 sentences ideally). ABOUT ZAINAB: Name: {PORTFOLIO_DATA['name']} Title: {PORTFOLIO_DATA['title']} Location: {PORTFOLIO_DATA['location']} Summary: {PORTFOLIO_DATA['summary']} TECHNICAL SKILLS: {', '.join(PORTFOLIO_DATA['skills']['technical'])} SOFT SKILLS: {', '.join(PORTFOLIO_DATA['skills']['soft'])} LANGUAGES: {', '.join(PORTFOLIO_DATA['skills']['languages'])} EDUCATION: {chr(10).join([f"- {e['degree']} at {e['school']} ({e['year']}): {e['focus']}" for e in PORTFOLIO_DATA['education']])} PROJECTS: {chr(10).join([f"- {p['name']}: {p['description']} (Built with: {', '.join(p['tech'])})" for p in PORTFOLIO_DATA['projects']])} CERTIFICATES: {chr(10).join([f"- {c['title']} from {c['issuer']} ({c['year']}): {c['description']}" for c in PORTFOLIO_DATA['certificates']])} EXPERIENCE: {chr(10).join([f"{e['role']} at {e['company']} ({e['period']}): {', '.join(e['highlights'])}" for e in PORTFOLIO_DATA['experience']])} CONTACT INFORMATION: - Email: {PORTFOLIO_DATA['contact']['email']} - Phone: {PORTFOLIO_DATA['contact']['phone']} - LinkedIn: {PORTFOLIO_DATA['contact']['linkedin']} - GitHub: {PORTFOLIO_DATA['contact']['github']} - Location: {PORTFOLIO_DATA['contact']['location']} - Availability: {PORTFOLIO_DATA['contact']['availability']} INTERESTS: {', '.join(PORTFOLIO_DATA['interests'])} IMPORTANT INSTRUCTIONS: 1. Always be concise but informative (max 3-4 sentences per answer). 2. Mention specific project names when discussing work (Portfolio Website, PDF to Audio tool, Root Alert). 3. If asked about contact info, provide the email, phone, and LinkedIn URL. 4. If asked about current status, mention she is in 5th semester of BSSE with 3.90 CGPA. 5. If asked something NOT contained in the information above, or unrelated to the portfolio, say exactly: "That's a great question! You can contact me directly for more details." 6. Never make up information not provided above. 7. Be enthusiastic, professional, and encouraging. 8. If asked about availability or hiring, mention she is open to internships and freelance opportunities. 9. When discussing the PDF to Audio project, mention it's a Python desktop app using Tkinter. 10. When discussing Root Alert, mention it's a plant care web app with alarm features.""" # ==================== GROQ CLIENT SETUP ==================== @st.cache_resource def get_groq_client(): """Initialize Groq client with API key from secrets or environment.""" try: api_key = st.secrets["GROQ_API_KEY"] except KeyError: api_key = os.getenv("GROQ_API_KEY") if not api_key: st.error("🚨 **GROQ_API_KEY not found!**") st.info(""" Please set your Groq API key: - **Local**: Create `.streamlit/secrets.toml` with `GROQ_API_KEY = "your-key"` - **Hugging Face**: Go to Settings → Secrets and add `GROQ_API_KEY` """) st.stop() return Groq(api_key=api_key) client = get_groq_client() # ==================== SIDEBAR ==================== with st.sidebar: st.markdown("### 👩💻 About Zainab") st.write(f"**{PORTFOLIO_DATA['title']}**") st.write(f"📍 {PORTFOLIO_DATA['location']}") st.write(f"🎓 BSSE Student (CGPA: 3.90)") st.divider() st.subheader("📬 Contact") st.write(f"📧 {PORTFOLIO_DATA['contact']['email']}") st.write(f"📱 {PORTFOLIO_DATA['contact']['phone']}") st.write(f"💼 [LinkedIn]({PORTFOLIO_DATA['contact']['linkedin']})") st.write(f"🐙 [GitHub]({PORTFOLIO_DATA['contact']['github']})") st.divider() st.subheader("🛠️ Top Skills") skills_html = "" for skill in PORTFOLIO_DATA['skills']['technical'][:6]: skills_html += f'{skill}' st.markdown(skills_html, unsafe_allow_html=True) st.divider() st.subheader("🚀 Quick Actions") if st.button("🗑️ Clear Chat", use_container_width=True): st.session_state.messages = [] st.rerun() if st.button("📧 Email Me", use_container_width=True): st.markdown(f'Send Email', unsafe_allow_html=True) st.divider() st.caption("🤖 Powered by Groq + Llama 3") st.caption("Built with ❤️ by Zainab Bibi") # ==================== MAIN INTERFACE ==================== st.markdown(f"""