Update app.py
Browse files
app.py
CHANGED
|
@@ -92,16 +92,16 @@ def chat(query,history):
|
|
| 92 |
import gradio as gr
|
| 93 |
from huggingface_hub import HfFileSystem
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
def write_to_file(file_name,content):
|
| 98 |
file_path = f"datasets/mgreg555/samu_reference_book/" + file_name
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
|
| 106 |
# Example usage
|
| 107 |
|
|
|
|
| 92 |
import gradio as gr
|
| 93 |
from huggingface_hub import HfFileSystem
|
| 94 |
|
| 95 |
+
fs = HfFileSystem(token=os.environ.get('DATASET_ACCES'))
|
| 96 |
|
| 97 |
def write_to_file(file_name,content):
|
| 98 |
file_path = f"datasets/mgreg555/samu_reference_book/" + file_name
|
| 99 |
+
with fs.open(file_path, "r") as file_old:
|
| 100 |
+
content_old = file_old.read()
|
| 101 |
+
print(content_old)
|
| 102 |
|
| 103 |
+
with fs.open(file_path, "w") as file:
|
| 104 |
+
file.write(f"{content_old}\n" + content)
|
| 105 |
|
| 106 |
# Example usage
|
| 107 |
|