Yaron Koresh commited on
Commit
eabdfc8
·
verified ·
1 Parent(s): 8319e1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -25,6 +25,7 @@ from diffusers.utils import export_to_gif, load_image
25
  from huggingface_hub import hf_hub_download
26
  from safetensors.torch import load_file, save_file
27
  from diffusers import AnimateDiffPipeline, MotionAdapter, DDIMScheduler, StableDiffusionPipeline
 
28
 
29
  # logging
30
 
@@ -239,7 +240,12 @@ def handle_generate(*_inp):
239
  pipe_out = pipe_generate(*inp)
240
 
241
  if inp[5] != "":
242
-
 
 
 
 
 
243
 
244
  name = generate_random_string(12) + ( ".png" if time == 0 else ".gif" )
245
  if inp[4] == 0.0:
 
25
  from huggingface_hub import hf_hub_download
26
  from safetensors.torch import load_file, save_file
27
  from diffusers import AnimateDiffPipeline, MotionAdapter, DDIMScheduler, StableDiffusionPipeline
28
+ from PIL import Image, ImageDraw
29
 
30
  # logging
31
 
 
240
  pipe_out = pipe_generate(*inp)
241
 
242
  if inp[5] != "":
243
+ draw = ImageDraw.Draw(pipe_out)
244
+ textwidth, textheight = draw.textsize(inp[5])
245
+ margin = 10
246
+ x = width - textwidth - margin
247
+ y = height - textheight - margin
248
+ draw.text((x, y), inp[5])
249
 
250
  name = generate_random_string(12) + ( ".png" if time == 0 else ".gif" )
251
  if inp[4] == 0.0: