Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -155,11 +155,11 @@ def build_space(repo_name,file_name,file_content,access_token=""):
|
|
155 |
f.close()
|
156 |
# Upload a local file to the Space
|
157 |
commit_message = "Adding file test: "+str(uuid.uuid4())
|
158 |
-
|
159 |
print("File uploaded successfully.")
|
160 |
# Commit changes
|
161 |
commit_message += "\nInitial commit to the repository."+ local_file_path
|
162 |
-
|
163 |
return [{'role':'assistant','content': commit_message+'\nCommit Success' }]
|
164 |
except Exception as e:
|
165 |
print("ERROR ",e)
|
|
|
155 |
f.close()
|
156 |
# Upload a local file to the Space
|
157 |
commit_message = "Adding file test: "+str(uuid.uuid4())
|
158 |
+
api.upload_file(local_file_path, repo_id=repo_path, path=file_name, commit_message=commit_message)
|
159 |
print("File uploaded successfully.")
|
160 |
# Commit changes
|
161 |
commit_message += "\nInitial commit to the repository."+ local_file_path
|
162 |
+
api.commit_repo(space_id, message=commit_message)
|
163 |
return [{'role':'assistant','content': commit_message+'\nCommit Success' }]
|
164 |
except Exception as e:
|
165 |
print("ERROR ",e)
|