Update app.py
Browse files
app.py
CHANGED
|
@@ -93,15 +93,19 @@ from huggingface_hub import HfApi
|
|
| 93 |
|
| 94 |
api = HfApi()
|
| 95 |
|
| 96 |
-
|
| 97 |
def write_to_file(file_name, value):
|
|
|
|
| 98 |
with open(file_name, 'a', encoding='utf-8') as file:
|
| 99 |
file.write(find_previous_question(value) + ';' + str(value) + '\n')
|
|
|
|
|
|
|
| 100 |
api.upload_file(
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
| 105 |
|
| 106 |
|
| 107 |
def vote(tmp, index_state, data: gr.LikeData):
|
|
|
|
| 93 |
|
| 94 |
api = HfApi()
|
| 95 |
|
|
|
|
| 96 |
def write_to_file(file_name, value):
|
| 97 |
+
# Write to the file
|
| 98 |
with open(file_name, 'a', encoding='utf-8') as file:
|
| 99 |
file.write(find_previous_question(value) + ';' + str(value) + '\n')
|
| 100 |
+
|
| 101 |
+
# Upload the file using its path
|
| 102 |
api.upload_file(
|
| 103 |
+
path_or_fileobj=file_name, # Use the file path instead of the file object
|
| 104 |
+
repo_id="mgreg555/docs_chat",
|
| 105 |
+
repo_type="space",
|
| 106 |
+
path_in_repo=file_name # Ensure this matches the file name if you want to keep the same name in the repo
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
|
| 110 |
|
| 111 |
def vote(tmp, index_state, data: gr.LikeData):
|