Afrinetwork7 commited on
Commit
8291039
1 Parent(s): df4e160

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -38,13 +38,14 @@ def save_image_to_s3(image):
38
  filename = f"generated_image_{int(time.time())}.png"
39
 
40
  # Upload to S3
41
- s3_client.put_object(Bucket=S3_BUCKET, Key=filename, Body=img_byte_arr)
 
 
 
 
42
 
43
- # Generate a pre-signed URL (valid for 1 hour)
44
- url = s3_client.generate_presigned_url('get_object',
45
- Params={'Bucket': S3_BUCKET,
46
- 'Key': filename},
47
- ExpiresIn=3600)
48
  return url
49
 
50
  def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
 
38
  filename = f"generated_image_{int(time.time())}.png"
39
 
40
  # Upload to S3
41
+ s3_client.put_object(Bucket=S3_BUCKET,
42
+ Key=filename,
43
+ Body=img_byte_arr,
44
+ ContentType='image/png',
45
+ ACL='public-read')
46
 
47
+ # Generate a public URL
48
+ url = f"https://{S3_BUCKET}.s3.{S3_REGION}.amazonaws.com/{filename}"
 
 
 
49
  return url
50
 
51
  def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):