Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,38 +10,100 @@ ds_model = ChatHuggingFace(llm = deep_seek_model, repo_id = 'deepseek-ai/DeepSee
|
|
| 10 |
|
| 11 |
st.title("ChatGenius Hub: Master Every Data Skills")
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# message = [SystemMessage(content = "Answer like a data scientist"),
|
| 14 |
# HumanMessage(content = "Tell me about Support Vector")]
|
| 15 |
# result = ds_model.invoke(message)
|
| 16 |
# print(result.content)
|
| 17 |
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
| 10 |
|
| 11 |
st.title("ChatGenius Hub: Master Every Data Skills")
|
| 12 |
|
| 13 |
+
|
| 14 |
+
# Set the default page in session state
|
| 15 |
+
if "page" not in st.session_state:
|
| 16 |
+
st.session_state.page = "home"
|
| 17 |
+
|
| 18 |
+
# Function to switch pages
|
| 19 |
+
def switch_page(page_name):
|
| 20 |
+
st.session_state.page = page_name
|
| 21 |
+
|
| 22 |
+
# Home page with buttons for different domains
|
| 23 |
+
if st.session_state.page == "home":
|
| 24 |
+
st.title("π€ Data Science Expert Bots")
|
| 25 |
+
st.markdown("Choose a domain to chat with an expert model:")
|
| 26 |
+
|
| 27 |
+
col1, col2, col3 = st.columns(3)
|
| 28 |
+
with col1:
|
| 29 |
+
if st.button("Python π"):
|
| 30 |
+
switch_page("python")
|
| 31 |
+
if st.button("Power BI π"):
|
| 32 |
+
switch_page("powerbi")
|
| 33 |
+
|
| 34 |
+
with col2:
|
| 35 |
+
if st.button("SQL π’οΈ"):
|
| 36 |
+
switch_page("sql")
|
| 37 |
+
if st.button("Deep Learning π§ "):
|
| 38 |
+
switch_page("deeplearning")
|
| 39 |
+
|
| 40 |
+
with col3:
|
| 41 |
+
if st.button("Machine Learning π€"):
|
| 42 |
+
switch_page("ml")
|
| 43 |
+
if st.button("Statistics π"):
|
| 44 |
+
switch_page("statistics")
|
| 45 |
+
|
| 46 |
+
# Example domain-specific chatbot page
|
| 47 |
+
elif st.session_state.page == "python":
|
| 48 |
+
st.title("Python Chatbot π")
|
| 49 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 50 |
+
# Here you can load your Python LLM and chat interface
|
| 51 |
+
|
| 52 |
+
elif st.session_state.page == "sql":
|
| 53 |
+
st.title("SQL Chatbot π’οΈ")
|
| 54 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 55 |
+
# Load SQL chatbot here
|
| 56 |
+
|
| 57 |
+
elif st.session_state.page == "powerbi":
|
| 58 |
+
st.title("Power BI Chatbot π")
|
| 59 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 60 |
+
|
| 61 |
+
elif st.session_state.page == "ml":
|
| 62 |
+
st.title("Machine Learning Chatbot π€")
|
| 63 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 64 |
+
|
| 65 |
+
elif st.session_state.page == "deeplearning":
|
| 66 |
+
st.title("Deep Learning Chatbot π§ ")
|
| 67 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 68 |
+
|
| 69 |
+
elif st.session_state.page == "statistics":
|
| 70 |
+
st.title("Statistics Chatbot π")
|
| 71 |
+
st.button("β¬
οΈ Back to Home", on_click=lambda: switch_page("home"))
|
| 72 |
+
|
| 73 |
+
|
| 74 |
# message = [SystemMessage(content = "Answer like a data scientist"),
|
| 75 |
# HumanMessage(content = "Tell me about Support Vector")]
|
| 76 |
# result = ds_model.invoke(message)
|
| 77 |
# print(result.content)
|
| 78 |
|
| 79 |
|
| 80 |
+
|
| 81 |
+
# if "messages" not in st.session_state:
|
| 82 |
+
# st.session_state.messages = [
|
| 83 |
+
# SystemMessage(content="Answer like a data scientist")
|
| 84 |
+
# ]
|
| 85 |
+
|
| 86 |
+
# def generate_response(user_input):
|
| 87 |
+
# # Append user message
|
| 88 |
+
# st.session_state.messages.append(HumanMessage(content=user_input))
|
| 89 |
+
# # Invoke the model
|
| 90 |
+
# response = ds_model.invoke(st.session_state.messages)
|
| 91 |
+
# # Append AI response
|
| 92 |
+
# st.session_state.messages.append(AIMessage(content=response))
|
| 93 |
+
# return response
|
| 94 |
+
|
| 95 |
+
# # User input
|
| 96 |
+
# user_input = st.text_input("Ask a question about Data Science:")
|
| 97 |
+
|
| 98 |
+
# if user_input:
|
| 99 |
+
# with st.spinner("Getting answer..."):
|
| 100 |
+
# answer = generate_response(user_input)
|
| 101 |
+
# st.markdown(f"**Answer:** {answer}")
|
| 102 |
+
|
| 103 |
+
# # Display chat history
|
| 104 |
+
# if st.session_state.messages:
|
| 105 |
+
# for msg in st.session_state.messages[1:]: # skip initial SystemMessage
|
| 106 |
+
# if isinstance(msg, HumanMessage):
|
| 107 |
+
# st.markdown(f"**You:** {msg.content}")
|
| 108 |
+
# elif isinstance(msg, AIMessage):
|
| 109 |
+
# st.markdown(f"**Bot:** {msg.content}")
|