Pranav0111 commited on
Commit
c337765
·
verified ·
1 Parent(s): 241e2a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -6,6 +6,7 @@ from pages import (
6
  render_brainstorm_page,
7
  render_chat
8
  )
 
9
 
10
 
11
  def main():
@@ -16,9 +17,24 @@ def main():
16
  initial_sidebar_state="expanded"
17
  )
18
 
19
- # Create a selection box to choose between pages
20
- page = st.sidebar.radio("Select a page", ["Home", "Dashboard", "Analytics", "Brainstorm", "Chat"])
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  if page == "Home":
23
  render_home()
24
  elif page == "Dashboard":
@@ -28,8 +44,11 @@ def main():
28
  elif page == "Brainstorm":
29
  render_brainstorm_page()
30
  elif page == "Chat":
31
- render_chat()
 
32
 
33
 
34
  if __name__ == "__main__":
 
 
35
  main()
 
6
  render_brainstorm_page,
7
  render_chat
8
  )
9
+ from chatbot import ChatbotManager # Import the new ChatbotManager
10
 
11
 
12
  def main():
 
17
  initial_sidebar_state="expanded"
18
  )
19
 
20
+ # Initialize the chatbot manager (will load the model)
21
+ chatbot_manager = ChatbotManager()
22
 
23
+ # Sidebar configuration
24
+ with st.sidebar:
25
+ st.image("https://via.placeholder.com/150x50?text=Prospira", width=150)
26
+ st.title("Navigation")
27
+
28
+ # Create a selection box to choose between pages
29
+ page = st.radio("Select a page",
30
+ ["Home", "Dashboard", "Analytics", "Brainstorm", "Chat"],
31
+ label_visibility="collapsed")
32
+
33
+ st.markdown("---")
34
+ st.caption(f"Model: Blenderbot-400M")
35
+ st.caption(f"Running on: {'GPU' if torch.cuda.is_available() else 'CPU'}")
36
+
37
+ # Page routing
38
  if page == "Home":
39
  render_home()
40
  elif page == "Dashboard":
 
44
  elif page == "Brainstorm":
45
  render_brainstorm_page()
46
  elif page == "Chat":
47
+ # Pass the chatbot manager to the chat page
48
+ render_chat(chatbot_manager)
49
 
50
 
51
  if __name__ == "__main__":
52
+ # Add torch import at runtime if not using it elsewhere
53
+ import torch
54
  main()