Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,14 +87,14 @@ def upload_to_gcs(image_bytes, filename):
|
|
| 87 |
print("⚠️ GCS client not initialized. Skipping upload.")
|
| 88 |
return
|
| 89 |
try:
|
| 90 |
-
print(f"--> Starting GCS upload for {}...")
|
| 91 |
bucket = gcs_client.bucket(GCS_BUCKET_NAME)
|
| 92 |
-
blob = bucket.blob(f"stablediff/{}")
|
| 93 |
# The image_bytes is already a bytes object, so we can upload it directly
|
| 94 |
blob.upload_from_string(image_bytes, content_type='image/jpeg')
|
| 95 |
-
print(f"✅ Successfully uploaded {} to GCS.")
|
| 96 |
except Exception as e:
|
| 97 |
-
print(f"❌ An error occurred during GCS upload for {}: {}")
|
| 98 |
|
| 99 |
|
| 100 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 87 |
print("⚠️ GCS client not initialized. Skipping upload.")
|
| 88 |
return
|
| 89 |
try:
|
| 90 |
+
print(f"--> Starting GCS upload for {filename}...")
|
| 91 |
bucket = gcs_client.bucket(GCS_BUCKET_NAME)
|
| 92 |
+
blob = bucket.blob(f"stablediff/{filename}")
|
| 93 |
# The image_bytes is already a bytes object, so we can upload it directly
|
| 94 |
blob.upload_from_string(image_bytes, content_type='image/jpeg')
|
| 95 |
+
print(f"✅ Successfully uploaded {filename} to GCS.")
|
| 96 |
except Exception as e:
|
| 97 |
+
print(f"❌ An error occurred during GCS upload for {filename}: {e}")
|
| 98 |
|
| 99 |
|
| 100 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|