@@ -22,18 +22,19 @@ def __():
22
22
23
23
@app .cell
24
24
def __ (font_name , font_size , mo , text ):
25
- from PIL import Image , ImageDraw , ImageFont
26
- from io import BytesIO
27
- import os
28
25
import base64
26
+ import os
27
+ from io import BytesIO
29
28
from textwrap import dedent
30
29
30
+ from PIL import Image , ImageDraw , ImageFont
31
+
31
32
width = 1944
32
33
height = 1024
33
34
image = Image .new ("RGB" , (width , height ), color = "white" )
34
35
draw = ImageDraw .Draw (image )
35
36
try :
36
- font = ImageFont .truetype (f"fonts/{ font_name } .ttf" , font_size )
37
+ font = ImageFont .truetype (f"../ fonts/{ font_name } .ttf" , font_size )
37
38
except IOError :
38
39
print ("Couldn't load font" )
39
40
font = ImageFont .load_default (font_size )
@@ -115,10 +116,10 @@ def __(mo):
115
116
@app .cell
116
117
def __ (os ):
117
118
from substrate import (
118
- Substrate ,
119
119
GenerateImage ,
120
- StableDiffusionXLControlNet ,
121
120
RemoveBackground ,
121
+ StableDiffusionXLControlNet ,
122
+ Substrate ,
122
123
UpscaleImage ,
123
124
)
124
125
@@ -157,9 +158,11 @@ def __(
157
158
strength = 0.6 ,
158
159
num_images = 1 ,
159
160
)
161
+
162
+ upscale_prompt = form .value ["upscale_prompt" ]
160
163
upscale = UpscaleImage (
161
164
image_uri = controlnet .future .outputs [0 ].image_uri ,
162
- prompt = f"{ form . value [ " upscale_prompt" ] } { prompt } " ,
165
+ prompt = f"{ upscale_prompt } { prompt } " ,
163
166
output_resolution = 2048 ,
164
167
)
165
168
res = substrate .run (upscale )
@@ -185,6 +188,7 @@ def __(controlnet, mask, mo, res, upscale):
185
188
@app .cell
186
189
def __ (BytesIO , Image , ImageDraw , base64 , font , height , text , width , x , y ):
187
190
import re
191
+
188
192
import numpy as np
189
193
from PIL import ImageChops
190
194
0 commit comments