peterpull commited on
Commit
53e90e0
·
1 Parent(s): 63c93d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -25,18 +25,7 @@ repo = Repository(
25
  clone_from=DATASET_REPO_URL,
26
  use_auth_token=HF_TOKEN)
27
 
28
-
29
- def generate_text() -> str:
30
- with open(DATA_FILE) as file:
31
- text = ""
32
- for line in file:
33
- row_parts = line.strip().split(",")
34
- if len(row_parts) != 3:
35
- continue
36
- time, user, chatbot = row_parts
37
- text += f"Time: {time}\nUser: {user}\nChatbot: {chatbot}\n\n"
38
- return text if text else "No messages yet"
39
-
40
  def store_message(chatinput: str, chatresponse: str):
41
  if chatinput and chatresponse:
42
  with open(DATA_FILE, "a") as file:
@@ -44,7 +33,6 @@ def store_message(chatinput: str, chatresponse: str):
44
  timestamp = now.strftime("%Y-%m-%d %H:%M:%S")
45
  file.write(f"{timestamp},{chatinput},{chatresponse}\n")
46
 
47
- return generate_text()
48
 
49
  #gets the index file which is the context data
50
  def get_index(index_file_path):
 
25
  clone_from=DATASET_REPO_URL,
26
  use_auth_token=HF_TOKEN)
27
 
28
+ #appends to data.txt in the dataset repo
 
 
 
 
 
 
 
 
 
 
 
29
  def store_message(chatinput: str, chatresponse: str):
30
  if chatinput and chatresponse:
31
  with open(DATA_FILE, "a") as file:
 
33
  timestamp = now.strftime("%Y-%m-%d %H:%M:%S")
34
  file.write(f"{timestamp},{chatinput},{chatresponse}\n")
35
 
 
36
 
37
  #gets the index file which is the context data
38
  def get_index(index_file_path):