botsi commited on
Commit
a172a7b
·
verified ·
1 Parent(s): 143a130

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -339,15 +339,16 @@ def generate(
339
 
340
  # Generate timestamp
341
  timestamp = datetime.datetime.now()
342
-
343
- # Check if the file already exists
344
  if os.path.exists(data_file):
345
  # If file exists, load existing data
346
  existing_data = pd.read_csv(data_file)
347
 
348
- # Add timestamp column
349
  conversation_df = pd.DataFrame(conversation)
 
350
  conversation_df['timestamp'] = timestamp
 
351
 
352
  # Append new conversation to existing data
353
  updated_data = pd.concat([existing_data, conversation_df], ignore_index=True)
@@ -355,7 +356,9 @@ def generate(
355
  else:
356
  # If file doesn't exist, create new file with conversation data
357
  conversation_df = pd.DataFrame(conversation)
 
358
  conversation_df['timestamp'] = timestamp
 
359
  conversation_df.to_csv(data_file, index=False)
360
 
361
  print("Updating .csv")
 
339
 
340
  # Generate timestamp
341
  timestamp = datetime.datetime.now()
342
+
 
343
  if os.path.exists(data_file):
344
  # If file exists, load existing data
345
  existing_data = pd.read_csv(data_file)
346
 
347
+ # Add timestamp, message and a readable sentence column
348
  conversation_df = pd.DataFrame(conversation)
349
+ conversation_df['message'] = message
350
  conversation_df['timestamp'] = timestamp
351
+ conversation_df['readable_sentence'] = readable_sentence
352
 
353
  # Append new conversation to existing data
354
  updated_data = pd.concat([existing_data, conversation_df], ignore_index=True)
 
356
  else:
357
  # If file doesn't exist, create new file with conversation data
358
  conversation_df = pd.DataFrame(conversation)
359
+ conversation_df['message'] = message
360
  conversation_df['timestamp'] = timestamp
361
+ conversation_df['readable_sentence'] = readable_sentence
362
  conversation_df.to_csv(data_file, index=False)
363
 
364
  print("Updating .csv")