import streamlit as st import os from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace from langchain_core.messages import HumanMessage, SystemMessage # Set environment variables for Hugging Face token hf = os.getenv('HF_TOKEN') os.environ['HUGGINGFACEHUB_API_TOKEN'] = hf os.environ['HF_TOKEN'] = hf # Page config st.set_page_config(page_title="Deep Learning Mentor Chat", layout="centered") # Custom CSS for modern chat UI st.markdown(""" """, unsafe_allow_html=True) # App title st.markdown("
Learn Deep Learning with personalized AI mentorship
", unsafe_allow_html=True) # Sidebar for experience level st.sidebar.title("🎓 Select Your Level") exp = st.sidebar.selectbox("Experience Level", ["Beginner", "Intermediate", "Expert"]) # Load Deep Learning model mentor_llm = HuggingFaceEndpoint( repo_id='Qwen/Qwen3-32B', provider='sambanova', temperature=0.7, max_new_tokens=150, task='conversational' ) deep_mentor = ChatHuggingFace(llm=mentor_llm) # Session key for conversation PAGE_KEY = "deep_learning_chat_history" if PAGE_KEY not in st.session_state: st.session_state[PAGE_KEY] = [] # Chat input form st.markdown("