tarrasyed19472007 commited on
Commit
21a48a4
·
verified ·
1 Parent(s): 47bc7c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -1,9 +1,20 @@
1
- import streamlit as st
 
 
 
 
 
 
 
 
 
2
  from src import utils
3
  from src.llm import EmotionalChatbot
4
  from src.log import logger
5
 
6
  # Streamlit UI Setup
 
 
7
  st.set_page_config(
8
  page_title="Emotional Intelligence Bot",
9
  page_icon="🤖",
@@ -43,7 +54,7 @@ if user_input:
43
  try:
44
  with st.spinner("Thinking..."):
45
  response = chatbot.generate_response(user_input)
46
- message = {'human':user_input, 'AI':response}
47
  st.session_state.chat_history.append(message)
48
  with st.chat_message("assistant"):
49
  st.write(response)
@@ -51,7 +62,3 @@ if user_input:
51
  logger.error(f"Error generating bot response: {e}")
52
  st.error("An error occurred. Check logs for more details.")
53
 
54
- import sys
55
- print("Python Path:", sys.path)
56
-
57
-
 
1
+ import sys
2
+ import os
3
+
4
+ # Dynamically add the 'src' directory to the Python path
5
+ current_dir = os.path.dirname(os.path.abspath(__file__))
6
+ src_dir = os.path.join(current_dir, 'src')
7
+ if src_dir not in sys.path:
8
+ sys.path.insert(0, src_dir)
9
+
10
+ # Import modules from the 'src' directory
11
  from src import utils
12
  from src.llm import EmotionalChatbot
13
  from src.log import logger
14
 
15
  # Streamlit UI Setup
16
+ import streamlit as st
17
+
18
  st.set_page_config(
19
  page_title="Emotional Intelligence Bot",
20
  page_icon="🤖",
 
54
  try:
55
  with st.spinner("Thinking..."):
56
  response = chatbot.generate_response(user_input)
57
+ message = {'human': user_input, 'AI': response}
58
  st.session_state.chat_history.append(message)
59
  with st.chat_message("assistant"):
60
  st.write(response)
 
62
  logger.error(f"Error generating bot response: {e}")
63
  st.error("An error occurred. Check logs for more details.")
64