weijiang2024 commited on
Commit
c2f9a5b
·
verified ·
1 Parent(s): 1b34141

Upload folder using huggingface_hub

Browse files
app.py CHANGED
@@ -6,6 +6,7 @@ from PIL import Image
6
  import requests
7
  import time
8
  import getpass
 
9
 
10
  # Get the API key
11
  STABILITY_API_KEY = os.environ.get('STABILITY_API_KEY') # Try to get from environment variable
@@ -72,7 +73,11 @@ def generate_image(brand_name, type, coupon_info, address, prompt, negative_prom
72
  # Convert image to PIL format
73
  image = Image.open(BytesIO(output_image))
74
 
75
- # TODO: 新增 品牌名称
 
 
 
 
76
  # TODO: 新增 类别
77
  # TODO: 新增 折扣信息
78
  # TODO: 新增 实体店地址
 
6
  import requests
7
  import time
8
  import getpass
9
+ from PIL import ImageDraw, ImageFont
10
 
11
  # Get the API key
12
  STABILITY_API_KEY = os.environ.get('STABILITY_API_KEY') # Try to get from environment variable
 
73
  # Convert image to PIL format
74
  image = Image.open(BytesIO(output_image))
75
 
76
+ # Add brand info to the upper left corner
77
+ draw = ImageDraw.Draw(image)
78
+ font = ImageFont.truetype("./arial-font/arial.ttf", 20) # You can change the font and size
79
+ draw.text((10, 10), brand_name, fill=(255, 255, 255), font=font) # Adjust position and color as needed
80
+
81
  # TODO: 新增 类别
82
  # TODO: 新增 折扣信息
83
  # TODO: 新增 实体店地址
arial-font/ARIBL0.ttf ADDED
Binary file (57.4 kB). View file
 
arial-font/ArialTh.ttf ADDED
Binary file (41 kB). View file
 
arial-font/Arialn.ttf ADDED
Binary file (60 kB). View file
 
arial-font/GEO_AI__.TTF ADDED
Binary file (60.4 kB). View file
 
arial-font/G_ari_bd.TTF ADDED
Binary file (133 kB). View file
 
arial-font/G_ari_i.TTF ADDED
Binary file (144 kB). View file
 
arial-font/arial.ttf ADDED
Binary file (915 kB). View file