Spaces:
Runtime error
Runtime error
storing 3d models
Browse files- google_buckets.py +24 -3
google_buckets.py
CHANGED
@@ -1,11 +1,31 @@
|
|
1 |
from google.cloud import storage
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# Initialize Google Cloud Storage client
|
4 |
client = storage.Client()
|
5 |
|
6 |
# Define bucket and file name
|
7 |
-
bucket_name = '
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Function to upload a .glb file to the bucket
|
11 |
def upload_file(file_path):
|
@@ -30,7 +50,8 @@ def delete_file():
|
|
30 |
|
31 |
def main():
|
32 |
# Example usage
|
33 |
-
|
|
|
34 |
download_file('path/to/save/your/file.glb')
|
35 |
delete_file()
|
36 |
|
|
|
1 |
from google.cloud import storage
|
2 |
+
import os
|
3 |
+
import json
|
4 |
|
5 |
+
SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
6 |
+
|
7 |
+
# https://stackoverflow.com/questions/71878229/initializing-firebase-admin-via-environment-variables-without-storing-serviceacc
|
8 |
+
key_dict = json.loads(
|
9 |
+
os.environ["GOOGLE_APPLICATION_CREDENTIALS_JSON"]
|
10 |
+
)
|
11 |
+
|
12 |
+
SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
13 |
+
|
14 |
+
|
15 |
+
# fire_app = firebase_admin.initialize_app(Certificate(key_dict))
|
16 |
+
|
17 |
+
|
18 |
+
# db = client = firestore.client(app=fire_app)
|
19 |
# Initialize Google Cloud Storage client
|
20 |
client = storage.Client()
|
21 |
|
22 |
# Define bucket and file name
|
23 |
+
# bucket_name = os.getenv('GOOGLE_PROJECT_ID')
|
24 |
+
bucket_name = "production-blender-platform-bucket"
|
25 |
+
# file_name = 'your-file.glb'
|
26 |
+
file_name = "tmpcpd7o7v0.glb"
|
27 |
+
|
28 |
+
|
29 |
|
30 |
# Function to upload a .glb file to the bucket
|
31 |
def upload_file(file_path):
|
|
|
50 |
|
51 |
def main():
|
52 |
# Example usage
|
53 |
+
file_name = "tmpcpd7o7v0.glb"
|
54 |
+
upload_file(file_name)
|
55 |
download_file('path/to/save/your/file.glb')
|
56 |
delete_file()
|
57 |
|