Update app.py
Browse files
app.py
CHANGED
|
@@ -125,16 +125,19 @@ def talk(prompt, history):
|
|
| 125 |
print("history log")
|
| 126 |
print(str(historylog))
|
| 127 |
print("history log string printed")
|
| 128 |
-
|
| 129 |
-
# write data to file
|
| 130 |
-
with open('file.txt', 'a') as data:
|
| 131 |
-
data.write(historylog)
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
print("History log printed:")
|
| 136 |
print(data.read())
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
| 138 |
# from huggingface_hub import HfApi
|
| 139 |
# api = HfApi()
|
| 140 |
# api.upload_file(
|
|
|
|
| 125 |
print("history log")
|
| 126 |
print(str(historylog))
|
| 127 |
print("history log string printed")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
+
try:
|
| 130 |
+
# write data to file
|
| 131 |
+
with open('file.txt', 'a') as data:
|
| 132 |
+
data.write(historylog)
|
| 133 |
+
data.seek(0)
|
| 134 |
+
# Read the contents of the file to display it.
|
| 135 |
print("History log printed:")
|
| 136 |
print(data.read())
|
| 137 |
+
|
| 138 |
+
except IOError as e:
|
| 139 |
+
print(f"An error occurred: {e}")
|
| 140 |
+
|
| 141 |
# from huggingface_hub import HfApi
|
| 142 |
# api = HfApi()
|
| 143 |
# api.upload_file(
|