Spaces:
Sleeping
Sleeping
| import os | |
| import streamlit as st | |
| from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate | |
| from langchain_huggingface import HuggingFaceEndpoint, HuggingFacePipeline, ChatHuggingFace | |
| os.environ["HUGGINGFACEHUB_API_TOKEN"] = os.getenv("key") | |
| os.environ["HF_TOKEN"] = os.getenv("key") | |
| st.set_page_config(page_title="Innomatics Online Trainer Bot", page_icon="π§ ", layout="centered") | |
| st.markdown(""" | |
| <style> | |
| .main { | |
| background-color: #8B0000; | |
| padding: 20px; | |
| } | |
| .stButton>button { | |
| background-color: white; | |
| color: #8B0000; | |
| border: 2px solid white; | |
| border-radius: 10px; | |
| padding: 10px 20px; | |
| font-size: 18px; | |
| font-weight: bold; | |
| width: 100%; | |
| transition: 0.3s ease-in-out; | |
| } | |
| .stButton>button:hover { | |
| background-color: #8B0000; | |
| color: white; | |
| border: 2px solid white; | |
| } | |
| /* Change all text to black */ | |
| h1, h2, h3, h4, h5, h6, p, div, span, label, input, textarea, select, option, .stTextInput, .stSlider, .stSelectbox, .stTextArea, .stMarkdown { | |
| color: black !important; | |
| } | |
| .chat-message { | |
| padding: 10px; | |
| margin: 5px 0; | |
| border-radius: 5px; | |
| } | |
| .user-message { | |
| background-color: rgba(183, 111, 39, 0.3); | |
| text-align: right; | |
| } | |
| .bot-message { | |
| background-color: rgba(139, 0, 0, 0.3); | |
| } | |
| .module-btn { | |
| font-size: 24px !important; | |
| padding: 15px 0 !important; | |
| } | |
| /* Ensure error and warning messages are visible */ | |
| .stAlert { | |
| color: black !important; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| st.markdown("<h1 style='text-align: center'>Innomatics AI Mentor Bot π§ </h1>", unsafe_allow_html=True) | |
| st.markdown("### π Welcome to the Innomatics AI Mentor Bot π€") | |
| st.markdown(''' | |
| This dashboard provides an AI mentor that gives instant, skill-adapted help with Python, SQL, PowerBI, and data science to guide you through module doubts. | |
| ''') | |
| st.markdown("## In which module do you have doubt?") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| python_btn = st.button("π Python", key="python_btn", help="Get help with Python programming") | |
| with col2: | |
| sql_btn = st.button("ποΈ SQL", key="sql_btn", help="Get help with SQL databases") | |
| with col3: | |
| powerbi_btn = st.button("π PowerBI", key="powerbi_btn", help="Get help with PowerBI dashboards") | |
| col4, col5, col6 = st.columns(3) | |
| with col4: | |
| stats_btn = st.button("π Statistics", key="stats_btn", help="Get help with Statistics") | |
| with col5: | |
| ml_btn = st.button("π€ Machine Learning", key="ml_btn", help="Get help with Machine Learning") | |
| with col6: | |
| dl_btn = st.button("π§ Deep Learning", key="dl_btn", help="Get help with Deep Learning") | |
| # Initialize session state for mentor type if it doesn't exist | |
| if 'mentor_type' not in st.session_state: | |
| st.session_state.mentor_type = None | |
| if 'mentor_emoji' not in st.session_state: | |
| st.session_state.mentor_emoji = "π§ " | |
| # Set mentor type based on button clicks | |
| if python_btn: | |
| st.session_state.mentor_type = "Python" | |
| st.session_state.mentor_emoji = "π" | |
| elif sql_btn: | |
| st.session_state.mentor_type = "SQL" | |
| st.session_state.mentor_emoji = "ποΈ" | |
| elif powerbi_btn: | |
| st.session_state.mentor_type = "PowerBI" | |
| st.session_state.mentor_emoji = "π" | |
| elif stats_btn: | |
| st.session_state.mentor_type = "Statistics" | |