Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,39 +49,6 @@ if st.session_state.page == "home":
|
|
| 49 |
# Example domain-specific chatbot page
|
| 50 |
elif st.session_state.page == "python":
|
| 51 |
st.title("Python Chatbot 🐍")
|
| 52 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 53 |
-
# Here you can load your Python LLM and chat interface
|
| 54 |
-
|
| 55 |
-
elif st.session_state.page == "sql":
|
| 56 |
-
st.title("SQL Chatbot 🛢️")
|
| 57 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 58 |
-
# Load SQL chatbot here
|
| 59 |
-
|
| 60 |
-
elif st.session_state.page == "powerbi":
|
| 61 |
-
st.title("Power BI Chatbot 📊")
|
| 62 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 63 |
-
|
| 64 |
-
elif st.session_state.page == "ml":
|
| 65 |
-
st.title("Machine Learning Chatbot 🤖")
|
| 66 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 67 |
-
|
| 68 |
-
elif st.session_state.page == "deeplearning":
|
| 69 |
-
st.title("Deep Learning Chatbot 🧠")
|
| 70 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 71 |
-
|
| 72 |
-
elif st.session_state.page == "statistics":
|
| 73 |
-
st.title("Statistics Chatbot 📈")
|
| 74 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 75 |
-
|
| 76 |
-
elif st.session_state.page == "genai":
|
| 77 |
-
st.title("GenAI Chatbot 📈")
|
| 78 |
-
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
def python_page():
|
| 84 |
-
st.title("Python Chatbot")
|
| 85 |
hf_token = os.getenv("HUGGINGFACEHUB_API_TOKEN") or os.getenv("HF_TOKEN")
|
| 86 |
if not hf_token:
|
| 87 |
st.error("Please add your Hugging Face API token to Secrets (HUGGINGFACEHUB_API_TOKEN or HF_TOKEN).")
|
|
@@ -121,7 +88,7 @@ def python_page():
|
|
| 121 |
return response
|
| 122 |
|
| 123 |
# User input
|
| 124 |
-
user_input = st.text_input("Ask a question about
|
| 125 |
|
| 126 |
if user_input:
|
| 127 |
with st.spinner("Getting answer..."):
|
|
@@ -135,5 +102,34 @@ def python_page():
|
|
| 135 |
st.markdown(f"**You:** {msg.content}")
|
| 136 |
elif isinstance(msg, AIMessage):
|
| 137 |
st.markdown(f"**Bot:** {msg.content}")
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
# Example domain-specific chatbot page
|
| 50 |
elif st.session_state.page == "python":
|
| 51 |
st.title("Python Chatbot 🐍")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
hf_token = os.getenv("HUGGINGFACEHUB_API_TOKEN") or os.getenv("HF_TOKEN")
|
| 53 |
if not hf_token:
|
| 54 |
st.error("Please add your Hugging Face API token to Secrets (HUGGINGFACEHUB_API_TOKEN or HF_TOKEN).")
|
|
|
|
| 88 |
return response
|
| 89 |
|
| 90 |
# User input
|
| 91 |
+
user_input = st.text_input("Ask a question about Python:")
|
| 92 |
|
| 93 |
if user_input:
|
| 94 |
with st.spinner("Getting answer..."):
|
|
|
|
| 102 |
st.markdown(f"**You:** {msg.content}")
|
| 103 |
elif isinstance(msg, AIMessage):
|
| 104 |
st.markdown(f"**Bot:** {msg.content}")
|
| 105 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 106 |
+
# Here you can load your Python LLM and chat interface
|
| 107 |
+
|
| 108 |
+
elif st.session_state.page == "sql":
|
| 109 |
+
st.title("SQL Chatbot 🛢️")
|
| 110 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 111 |
+
# Load SQL chatbot here
|
| 112 |
+
|
| 113 |
+
elif st.session_state.page == "powerbi":
|
| 114 |
+
st.title("Power BI Chatbot 📊")
|
| 115 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 116 |
+
|
| 117 |
+
elif st.session_state.page == "ml":
|
| 118 |
+
st.title("Machine Learning Chatbot 🤖")
|
| 119 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 120 |
+
|
| 121 |
+
elif st.session_state.page == "deeplearning":
|
| 122 |
+
st.title("Deep Learning Chatbot 🧠")
|
| 123 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 124 |
+
|
| 125 |
+
elif st.session_state.page == "statistics":
|
| 126 |
+
st.title("Statistics Chatbot 📈")
|
| 127 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 128 |
+
|
| 129 |
+
elif st.session_state.page == "genai":
|
| 130 |
+
st.title("GenAI Chatbot 📈")
|
| 131 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
|