Yvann commited on
Commit
0186eac
·
1 Parent(s): 48aa9b9

debug issue #12 now possible to actualize change made to modules in localhost

Browse files
.streamlit/config.toml CHANGED
@@ -4,4 +4,4 @@ primaryColor = "#89CFF0"
4
  backgroundColor = "#E0F7FE"
5
  secondaryBackgroundColor = "#FFFCE4"
6
  textColor = "#000000"
7
- font = "sans-serif"
 
4
  backgroundColor = "#E0F7FE"
5
  secondaryBackgroundColor = "#FFFCE4"
6
  textColor = "#000000"
7
+ font = "sans serif"
setup.sh CHANGED
@@ -17,5 +17,5 @@ primaryColor = \"#89CFF0\"\n\
17
  backgroundColor = \"#E0F7FE\"\n\
18
  secondaryBackgroundColor = \"#FFFCE4\"\n\
19
  textColor = \"#000000\"\n\
20
- font = \"sans-serif\"\n\
21
  " > ~/.streamlit/config.toml
 
17
  backgroundColor = \"#E0F7FE\"\n\
18
  secondaryBackgroundColor = \"#FFFCE4\"\n\
19
  textColor = \"#000000\"\n\
20
+ font = \"sans serif\"\n\
21
  " > ~/.streamlit/config.toml
src/chatbot_csv.py CHANGED
@@ -5,12 +5,32 @@ from io import BytesIO
5
  from io import StringIO
6
  import sys
7
  import re
 
 
8
  from modules.history import ChatHistory
9
  from modules.layout import Layout
10
  from modules.utils import Utilities
11
  from modules.sidebar import Sidebar
12
- from langchain.agents import create_csv_agent
13
- from langchain.chat_models import ChatOpenAI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  def init():
16
  load_dotenv()
@@ -35,8 +55,6 @@ def main():
35
 
36
  uploaded_file_content = BytesIO(uploaded_file.getvalue())
37
 
38
-
39
-
40
  try:
41
  chatbot = utils.setup_chatbot(
42
  uploaded_file, st.session_state["model"], st.session_state["temperature"]
@@ -84,7 +102,6 @@ def main():
84
  except Exception as e:
85
  st.error(f"Error: {str(e)}")
86
 
87
-
88
  sidebar.about()
89
 
90
  if __name__ == "__main__":
 
5
  from io import StringIO
6
  import sys
7
  import re
8
+ from langchain.agents import create_csv_agent
9
+ from langchain.chat_models import ChatOpenAI
10
  from modules.history import ChatHistory
11
  from modules.layout import Layout
12
  from modules.utils import Utilities
13
  from modules.sidebar import Sidebar
14
+
15
+ #To be able to update the changes made to modules in localhost,
16
+ #you can press the "r" key on the localhost page to refresh and reflect the changes made to the module files.
17
+ def reload_module(module_name):
18
+ import importlib
19
+ import sys
20
+ if module_name in sys.modules:
21
+ importlib.reload(sys.modules[module_name])
22
+ return sys.modules[module_name]
23
+
24
+ history_module = reload_module('modules.history')
25
+ layout_module = reload_module('modules.layout')
26
+ utils_module = reload_module('modules.utils')
27
+ sidebar_module = reload_module('modules.sidebar')
28
+
29
+ ChatHistory = history_module.ChatHistory
30
+ Layout = layout_module.Layout
31
+ Utilities = utils_module.Utilities
32
+ Sidebar = sidebar_module.Sidebar
33
+
34
 
35
  def init():
36
  load_dotenv()
 
55
 
56
  uploaded_file_content = BytesIO(uploaded_file.getvalue())
57
 
 
 
58
  try:
59
  chatbot = utils.setup_chatbot(
60
  uploaded_file, st.session_state["model"], st.session_state["temperature"]
 
102
  except Exception as e:
103
  st.error(f"Error: {str(e)}")
104
 
 
105
  sidebar.about()
106
 
107
  if __name__ == "__main__":
src/tuto_chatbot_csv.py → tuto_chatbot_csv.py RENAMED
File without changes