farukbera commited on
Commit
daf0793
·
1 Parent(s): d436869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -40,10 +40,12 @@ async def generate_ad(image_file:UploadFile, hex_code:str, prompt: str = Query(.
40
 
41
  image_bytes = await image_file.read()
42
  init_image = Image.open(io.BytesIO(image_bytes)).convert("RGBA")
43
- init_image.thumbnail((768, 768))
44
- # Generate the image using the text-to-image model
45
  generator = torch.Generator(device=device1).manual_seed(1024)
46
- ad_prompt = f"From init image create me a new image that will attract customers to put in a (ad template) and use this hex code {hex_code} in the image"
 
 
47
 
48
  image = pipe(prompt=ad_prompt, image=init_image, strength=0.75, guidance_scale=7.5, generator=generator).images[0]
49
 
 
40
 
41
  image_bytes = await image_file.read()
42
  init_image = Image.open(io.BytesIO(image_bytes)).convert("RGBA")
43
+ #init_image.thumbnail((768, 768))
44
+ #Generate the image using the text-to-image model
45
  generator = torch.Generator(device=device1).manual_seed(1024)
46
+ ad_prompt = f"""Your system prompt is this: {prompt} Consider your system prompt first.
47
+ Then from init image create me a new image that will attract customers to put in a (ad template)
48
+ Also, use this hex code {hex_code} in the image"""
49
 
50
  image = pipe(prompt=ad_prompt, image=init_image, strength=0.75, guidance_scale=7.5, generator=generator).images[0]
51