Anshini commited on
Commit
39e6a75
·
verified ·
1 Parent(s): 9925762

Update pages/Sql.py

Browse files
Files changed (1) hide show
  1. pages/Sql.py +23 -2
pages/Sql.py CHANGED
@@ -5,9 +5,23 @@ from langchain_core.messages import HumanMessage, SystemMessage
5
 
6
  # Set environment variables
7
  hf = os.getenv('HF_TOKEN')
8
- os.environ['HUGGINGFACEHUB_API_TOKEN'] = hf
9
  os.environ['HF_TOKEN'] = hf
10
- # Page setup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  st.set_page_config(page_title="SQL Mentor Chat", layout="centered")
12
 
13
  # Improved custom CSS
@@ -76,6 +90,13 @@ st.markdown("<p style='margin-top: 0.2rem;'>Learn SQL interactively from your AI
76
  st.sidebar.title("Mentor Preferences")
77
  exp = st.sidebar.selectbox("Choose your experience level:", ["Beginner", "Intermediate", "Expert"])
78
 
 
 
 
 
 
 
 
79
  # Chat input box
80
  st.markdown("<hr>", unsafe_allow_html=True)
81
  with st.form(key="chat_form"):
 
5
 
6
  # Set environment variables
7
  hf = os.getenv('HF_TOKEN')
8
+ os.environ['HUGGINGFACEHUB_API_KEY'] = hf
9
  os.environ['HF_TOKEN'] = hf
10
+
11
+ # Initialize DeepSeek model (you can replace this with your own model if needed)
12
+ def load_deepseek_model():
13
+ deep_seek_model = HuggingFaceEndpoint(
14
+ repo_id="deepseek-ai/DeepSeek-R1",
15
+ provider="nebius",
16
+ temperature=0.7,
17
+ max_new_tokens=150,
18
+ task="conversational"
19
+ )
20
+ return ChatHuggingFace(llm=deep_seek_model)
21
+
22
+ sql_mentor = load_deepseek_model()
23
+
24
+ # Streamlit page setup
25
  st.set_page_config(page_title="SQL Mentor Chat", layout="centered")
26
 
27
  # Improved custom CSS
 
90
  st.sidebar.title("Mentor Preferences")
91
  exp = st.sidebar.selectbox("Choose your experience level:", ["Beginner", "Intermediate", "Expert"])
92
 
93
+ # Session state key
94
+ PAGE_KEY = "chat_history"
95
+
96
+ # Initialize session state
97
+ if PAGE_KEY not in st.session_state:
98
+ st.session_state[PAGE_KEY] = []
99
+
100
  # Chat input box
101
  st.markdown("<hr>", unsafe_allow_html=True)
102
  with st.form(key="chat_form"):