salomonsky
commited on
Commit
•
ba2e19b
1
Parent(s):
ee899d5
Update app.py
Browse files
app.py
CHANGED
@@ -34,17 +34,15 @@ async def generate_image(prompt, model, lora_word, width, height, scales, steps,
|
|
34 |
async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
|
35 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
36 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
37 |
-
image_path = "temp_image.jpg"
|
38 |
-
image.save(image_path,
|
39 |
|
40 |
if process_upscale:
|
41 |
-
upscale_image_path = "upscale_image.jpg"
|
42 |
upscale_image = get_upscale_finegrain(prompt, image_path, upscale_factor)
|
43 |
-
upscale_image.save(upscale_image_path, quality=95)
|
44 |
else:
|
45 |
-
|
46 |
-
|
47 |
-
return [image_path,
|
48 |
|
49 |
def get_upscale_finegrain(prompt, img_path, upscale_factor):
|
50 |
client = Client("finegrain/finegrain-image-enhancer", hf_token=HF_TOKEN_UPSCALER)
|
|
|
34 |
async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
|
35 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
36 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
37 |
+
image_path = "temp_image.jpg"
|
38 |
+
image.save(image_path, format="JPEG")
|
39 |
|
40 |
if process_upscale:
|
|
|
41 |
upscale_image = get_upscale_finegrain(prompt, image_path, upscale_factor)
|
|
|
42 |
else:
|
43 |
+
upscale_image = image_path
|
44 |
+
|
45 |
+
return [image_path, upscale_image]
|
46 |
|
47 |
def get_upscale_finegrain(prompt, img_path, upscale_factor):
|
48 |
client = Client("finegrain/finegrain-image-enhancer", hf_token=HF_TOKEN_UPSCALER)
|