mgreg555 commited on
Commit
cdf1ed1
·
verified ·
1 Parent(s): 23445d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
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
- path_or_fileobj=file,
102
- path_in_repo="docs_chat/"+file_name,
103
- repo_id="mgreg555/docs_chat",
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):