nickmuchi commited on
Commit
26366c2
1 Parent(s): 9e200e1

Update variables.py

Browse files
Files changed (1) hide show
  1. variables.py +2 -21
variables.py CHANGED
@@ -70,32 +70,13 @@ def process_tweets(df,df_users):
70
  df_tweets = df_tweets.sort_values(by=['creation_time'],ascending=False)
71
 
72
  return df_tweets
73
-
74
- @st.experimental_singleton(suppress_st_warning=True)
75
- def get_latest_file():
76
- '''Get the latest file from output folder'''
77
-
78
- # set the directory path
79
- directory_path = "/output/"
80
-
81
- # create a list of all text files in the directory and sort by modification time
82
- text_files = sorted(pathlib.Path(directory_path).glob("*.txt"), key=lambda f: f.stat().st_mtime)
83
-
84
- # get the latest modified file
85
- latest_file = text_files[-1]
86
-
87
- # open the file and read its contents
88
- with open(latest_file, "r") as f:
89
- file_contents = f.read()
90
-
91
- return file_contents
92
 
93
  @st.experimental_singleton(suppress_st_warning=True)
94
- def embed_tweets(file,model,query):
95
  '''Process file with latest tweets'''
96
 
97
  # Split tweets int chunks
98
- text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
99
  texts = text_splitter.split_text(file)
100
 
101
 
 
70
  df_tweets = df_tweets.sort_values(by=['creation_time'],ascending=False)
71
 
72
  return df_tweets
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  @st.experimental_singleton(suppress_st_warning=True)
75
+ def embed_tweets(file,model,query,prompt):
76
  '''Process file with latest tweets'''
77
 
78
  # Split tweets int chunks
79
+ text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
80
  texts = text_splitter.split_text(file)
81
 
82