Kaludi commited on
Commit
796c174
1 Parent(s): 2b10eb4

Upload 2 files

Browse files
Files changed (1) hide show
  1. pages/Brain_Search.py +6 -6
pages/Brain_Search.py CHANGED
@@ -23,8 +23,8 @@ def extract_text_from_txt(txt):
23
  return text
24
 
25
 
26
- def extract_text_from_diary():
27
- with open('diary/diary_journal.txt', 'r', encoding='utf-8') as file:
28
  text = file.read()
29
  return text
30
 
@@ -47,7 +47,7 @@ def main():
47
  if not api_key:
48
  st.warning("Please enter your OpenAI API key to continue.")
49
  else:
50
- file_type = st.selectbox("Choose the file type", options=["Diary", "PDF", "TXT"])
51
 
52
  file = None
53
  text = None
@@ -60,10 +60,10 @@ def main():
60
  file = st.file_uploader("Upload your TXT", type="txt")
61
  if file is not None:
62
  text = extract_text_from_txt(file)
63
- elif file_type == "Diary":
64
- text = extract_text_from_diary()
65
 
66
- if file is not None or file_type == "Diary":
67
  # split into chunks
68
  text_splitter = CharacterTextSplitter(
69
  separator="\n",
 
23
  return text
24
 
25
 
26
+ def extract_text_from_brain():
27
+ with open('brain/brain_journal.txt', 'r', encoding='utf-8') as file:
28
  text = file.read()
29
  return text
30
 
 
47
  if not api_key:
48
  st.warning("Please enter your OpenAI API key to continue.")
49
  else:
50
+ file_type = st.selectbox("Choose the file type", options=["Brain", "PDF", "TXT"])
51
 
52
  file = None
53
  text = None
 
60
  file = st.file_uploader("Upload your TXT", type="txt")
61
  if file is not None:
62
  text = extract_text_from_txt(file)
63
+ elif file_type == "Brain":
64
+ text = extract_text_from_brain()
65
 
66
+ if file is not None or file_type == "Brain":
67
  # split into chunks
68
  text_splitter = CharacterTextSplitter(
69
  separator="\n",