Namitg02 commited on
Commit
fadbc96
1 Parent(s): f17e225

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -3,8 +3,10 @@ from datasets import Dataset
3
  from sentence_transformers import SentenceTransformer
4
  import faiss
5
  import time
 
6
  import json
7
  #import torch
 
8
  import pandas as pd
9
  from llama_cpp import Llama
10
  #from langchain_community.llms import LlamaCpp
@@ -119,13 +121,14 @@ def talk(prompt, history):
119
 
120
  try:
121
  # write data to file
122
- timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
123
- filename = f"file_{timestamp}.txt"
124
- with open(f"./{filename}", "a") as data:
 
125
  data.write(historylog)
126
 
127
  print("History log printed:")
128
- with open(f"./{filename}", "r") as data:
129
  print(data.read())
130
 
131
  # with open("./file.txt", "a") as data:
 
3
  from sentence_transformers import SentenceTransformer
4
  import faiss
5
  import time
6
+ from datetime import datetime
7
  import json
8
  #import torch
9
+ import uuid
10
  import pandas as pd
11
  from llama_cpp import Llama
12
  #from langchain_community.llms import LlamaCpp
 
121
 
122
  try:
123
  # write data to file
124
+ unique_filename = f"file_{uuid.uuid4()}.txt"
125
+ # timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
126
+ # filename = f"file_{timestamp}.txt"
127
+ with open(unique_filename, "a") as data:
128
  data.write(historylog)
129
 
130
  print("History log printed:")
131
+ with open(unique_filename, "r") as data:
132
  print(data.read())
133
 
134
  # with open("./file.txt", "a") as data: