import streamlit as st import google.generativeai as genai import os import config import json import time from filter import is_solar_related # Import the solar query filter # Configure Gemini API genai.configure(api_key=config.API_KEY) def get_ai_response(user_input): model = genai.GenerativeModel("gemini-pro") # Using Gemini Pro model response = model.generate_content(user_input) return response.text if hasattr(response, "text") else "Error fetching response" # Set page config st.set_page_config( page_title="Solar Industry AI Assistant", page_icon="☀️", layout="wide", initial_sidebar_state="expanded" ) # Custom CSS for enhanced UI st.markdown(""" """, unsafe_allow_html=True) # Title with custom styling st.markdown('
🔍 Ask any question related to solar energy, installation, cost, regulations, and more!
', unsafe_allow_html=True) # Session state for chat history if "chat_history" not in st.session_state: st.session_state.chat_history = [] # Create tabs for main content and about section tab1, tab2 = st.tabs(["💬 Chat Assistant", "👤 About Me"]) with tab1: # Layout with columns in the main chat tab col1, col2 = st.columns([3, 1]) with col1: # Query input with enhanced styling st.markdown('Course: B.Tech (Artificial Intelligence & Machine Learning)
", unsafe_allow_html=True) st.markdown("College: Delhi Technical Campus, Greater Noida
", unsafe_allow_html=True) st.markdown("Affiliation: Guru Gobind Singh Indraprastha University, New Delhi
", unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) # Introduction st.subheader("👋 Introduction") st.write(""" Enthusiastic and dedicated student with expertise in Python, data structures, algorithms, and machine learning. Proficient with scikit-learn, tensorflow, numpy, and pandas. Experienced with natural language processing. Currently preparing for the GATE exam to enhance my technical knowledge. I am eager to contribute to unique projects and thrive in a dynamic environment. """) # Skills section st.markdown('', unsafe_allow_html=True) st.subheader("🛠️ Skills") # Programming Languages st.write("**Programming Languages:**") st.markdown('© 2025 Solar Industry AI Assistant | Developed by Uditanshu Pandey
', unsafe_allow_html=True)