mgreg555 commited on
Commit
03676b1
·
verified ·
1 Parent(s): b63cb45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -94,8 +94,12 @@ fs = HfFileSystem(token=os.environ["acces_token"])
94
 
95
  def write_to_file(file_name,content):
96
  file_path = f"spaces/mgreg555/docs_chat/" + file_name
97
- with fs.open(file_path, "a") as file:
98
- file.write(content)
 
 
 
 
99
 
100
  # Example usage
101
 
 
94
 
95
  def write_to_file(file_name,content):
96
  file_path = f"spaces/mgreg555/docs_chat/" + file_name
97
+ with fs.open(file_path, "r") as file_old:
98
+ content_old = file_old.read()
99
+ print(content_old)
100
+
101
+ with fs.open(file_path, "w") as file:
102
+ file.write(f"{content_old}\n" + content)
103
 
104
  # Example usage
105