Spaces:
Runtime error
Runtime error
fixing remote auth
Browse files- app.py +11 -4
- google_buckets.py +39 -39
app.py
CHANGED
@@ -51,6 +51,13 @@ def generate_apparatus(input_text, retriever_choice):
|
|
51 |
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
52 |
manager = CloudStorageManager(bucket_name)
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
for i in app_components:
|
55 |
|
56 |
client = ShapEClient("hysts/Shap-E")
|
@@ -142,12 +149,12 @@ def review_3d_model(uuid:str) -> None:
|
|
142 |
convert_obj_to_stl(xx,xx_as_stl)
|
143 |
viewing_angles = [(30, 45), (60, 90), (45, 135)]
|
144 |
|
145 |
-
prompt = "I am creating an 3d model
|
146 |
using a text-to-3d model\
|
147 |
Do these images look correct?\
|
148 |
-
If not please make a suggesttion on how to improve the text input
|
149 |
-
As this response will be used in a pipeline please only output a new
|
150 |
-
potential prompt or output nothing, "
|
151 |
# Please keep the prompt to 5 25 words to not confuse the model"
|
152 |
|
153 |
images = generate_mesh_images(
|
|
|
51 |
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
52 |
manager = CloudStorageManager(bucket_name)
|
53 |
|
54 |
+
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
55 |
+
|
56 |
+
credentials_str = SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
57 |
+
|
58 |
+
# Create an instance of CloudStorageManager
|
59 |
+
storage_manager = CloudStorageManager(bucket_name, credentials_str)
|
60 |
+
|
61 |
for i in app_components:
|
62 |
|
63 |
client = ShapEClient("hysts/Shap-E")
|
|
|
149 |
convert_obj_to_stl(xx,xx_as_stl)
|
150 |
viewing_angles = [(30, 45), (60, 90), (45, 135)]
|
151 |
|
152 |
+
prompt = "I am creating an 3d model ,\
|
153 |
using a text-to-3d model\
|
154 |
Do these images look correct?\
|
155 |
+
If not please make a suggesttion on how to improve the text input"
|
156 |
+
# As this response will be used in a pipeline please only output a new"
|
157 |
+
# potential prompt or output nothing, "
|
158 |
# Please keep the prompt to 5 25 words to not confuse the model"
|
159 |
|
160 |
images = generate_mesh_images(
|
google_buckets.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
from google.cloud import storage
|
2 |
-
import os
|
3 |
import json
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
from google.cloud import storage
|
8 |
|
9 |
class CloudStorageManager:
|
10 |
-
def __init__(self, bucket_name):
|
11 |
-
|
|
|
12 |
self.bucket_name = bucket_name
|
13 |
|
14 |
def upload_file(self, file_path, destination_file_name):
|
@@ -38,45 +35,48 @@ class CloudStorageManager:
|
|
38 |
return None
|
39 |
|
40 |
def main():
|
41 |
-
|
|
|
42 |
|
43 |
-
#
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
49 |
|
|
|
|
|
|
|
50 |
|
51 |
-
#
|
|
|
52 |
|
|
|
|
|
53 |
|
54 |
-
#
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
# uuid = '9ca1555c-e8ca-4111-a084-1a2374b2e6bd'.replace("-","")
|
62 |
-
uuid = "506bb34a122a4bea86a64f96933f6bbd"
|
63 |
-
xx = manager.get_file_by_uuid(uuid)
|
64 |
-
|
65 |
-
# manager.upload_file(
|
66 |
-
# "506bb34a122a4bea86a64f96933f6bbd.glb",
|
67 |
-
# "506bb34a122a4bea86a64f96933f6bbd.glb"
|
68 |
-
# )
|
69 |
-
|
70 |
-
manager.download_file(
|
71 |
-
xx,
|
72 |
-
xx
|
73 |
-
)
|
74 |
-
x = 0
|
75 |
|
76 |
-
# Example usage
|
77 |
-
# manager.upload_file("/home/isayahc/projects/Hackathon-Projects/Maker-Tech-Tree/7698996e43bf4aa1ba98f5dd0bf77000.glb", "7698996e43bf4aa1ba98f5dd0bf77000.glb")
|
78 |
-
# manager.download_file('your-file.glb', 'path/to/save/your/file.glb')
|
79 |
-
# manager.delete_file('your-file.glb')
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
main()
|
|
|
1 |
from google.cloud import storage
|
|
|
2 |
import json
|
3 |
+
import os
|
|
|
|
|
|
|
4 |
|
5 |
class CloudStorageManager:
|
6 |
+
def __init__(self, bucket_name, credentials_str):
|
7 |
+
credentials_dict = json.loads(credentials_str)
|
8 |
+
self.client = storage.Client.from_service_account_info(credentials_dict)
|
9 |
self.bucket_name = bucket_name
|
10 |
|
11 |
def upload_file(self, file_path, destination_file_name):
|
|
|
35 |
return None
|
36 |
|
37 |
def main():
|
38 |
+
# Replace 'your_bucket_name' with your actual bucket name
|
39 |
+
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
40 |
|
41 |
+
# Replace 'your_credentials_str' with your actual credentials string
|
42 |
+
# credentials_str = """
|
43 |
+
# {
|
44 |
+
# "type": "service_account",
|
45 |
+
# "project_id": "your_project_id",
|
46 |
+
# "private_key_id": "your_private_key_id",
|
47 |
+
# "private_key": "-----BEGIN PRIVATE KEY-----\nYourPrivateKey\n-----END PRIVATE KEY-----\n",
|
48 |
+
# "client_email": "your_client_email",
|
49 |
+
# "client_id": "your_client_id",
|
50 |
+
# "auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
51 |
+
# "token_uri": "https://oauth2.googleapis.com/token",
|
52 |
+
# "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
53 |
+
# "client_x509_cert_url": "your_client_x509_cert_url"
|
54 |
+
# }
|
55 |
+
# """
|
56 |
+
|
57 |
+
credentials_str = SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
58 |
|
59 |
+
# Create an instance of CloudStorageManager
|
60 |
+
storage_manager = CloudStorageManager(bucket_name, credentials_str)
|
61 |
|
62 |
+
# Example usage:
|
63 |
+
# Upload a file
|
64 |
+
storage_manager.upload_file('local_file_path', 'destination_file_name')
|
65 |
|
66 |
+
# Download a file
|
67 |
+
storage_manager.download_file('source_file_name', 'local_destination_path')
|
68 |
|
69 |
+
# Delete a file
|
70 |
+
storage_manager.delete_file('file_name_to_delete')
|
71 |
|
72 |
+
# Get file by UUID
|
73 |
+
uuid = 'your_uuid'
|
74 |
+
file_name = storage_manager.get_file_by_uuid(uuid)
|
75 |
+
if file_name:
|
76 |
+
print(f"File with UUID '{uuid}' found: {file_name}")
|
77 |
+
else:
|
78 |
+
print(f"No file found with UUID '{uuid}'")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
|
|
|
|
|
|
|
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
main()
|