John6666 commited on
Commit
40ecdbe
·
verified ·
1 Parent(s): 1698e81

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -7,7 +7,7 @@ from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler, Autoen
7
  from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5TokenizerFast
8
  from live_preview_helpers import calculate_shift, retrieve_timesteps, flux_pipe_call_that_returns_an_iterable_of_images
9
  from gradio_imageslider import ImageSlider
10
- from PIL import Image, ImageDraw
11
 
12
  dtype = torch.bfloat16
13
  #model_id = "black-forest-labs/FLUX.1-dev"
@@ -29,6 +29,7 @@ def get_cmp_image(im1: Image.Image, im2: Image.Image, sigmas: float):
29
  dst = Image.new('RGB', (im1.width + im2.width, im1.height))
30
  dst.paste(im1.convert('RGB'), (0, 0))
31
  dst.paste(im2.convert('RGB'), (im1.width, 0))
 
32
  draw = ImageDraw.Draw(dst)
33
  draw.text((64, 64), 'Default Flux', 'red')
34
  draw.text((im1.width + 64, 64), f'Sigmas * factor {sigmas}', 'red')
 
7
  from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5TokenizerFast
8
  from live_preview_helpers import calculate_shift, retrieve_timesteps, flux_pipe_call_that_returns_an_iterable_of_images
9
  from gradio_imageslider import ImageSlider
10
+ from PIL import Image, ImageDraw, ImageFont
11
 
12
  dtype = torch.bfloat16
13
  #model_id = "black-forest-labs/FLUX.1-dev"
 
29
  dst = Image.new('RGB', (im1.width + im2.width, im1.height))
30
  dst.paste(im1.convert('RGB'), (0, 0))
31
  dst.paste(im2.convert('RGB'), (im1.width, 0))
32
+ font = ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeMono.ttf', 36, encoding='unic')
33
  draw = ImageDraw.Draw(dst)
34
  draw.text((64, 64), 'Default Flux', 'red')
35
  draw.text((im1.width + 64, 64), f'Sigmas * factor {sigmas}', 'red')