jamescalam commited on
Commit
a414223
·
1 Parent(s): 4918b4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -93,8 +93,11 @@ def diffuse(text: str):
93
  im = out.images[0]
94
  im.save(f'{_id}.png', format='png')
95
  # push to storage
96
- blob = bucket.blob(f'images/{_id}.png')
97
- blob.upload_from_filename(f'{_id}.png')
 
 
 
98
  # delete local file
99
  os.remove(f'{_id}.png')
100
  # add embedding and metadata to Pinecone
 
93
  im = out.images[0]
94
  im.save(f'{_id}.png', format='png')
95
  # push to storage
96
+ try:
97
+ blob = bucket.blob(f'images/{_id}.png')
98
+ blob.upload_from_filename(f'{_id}.png')
99
+ except Exception as e:
100
+ print("New image not uploaded due to error...")
101
  # delete local file
102
  os.remove(f'{_id}.png')
103
  # add embedding and metadata to Pinecone