salomonsky commited on
Commit
581837a
1 Parent(s): 00fcfbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -14
app.py CHANGED
@@ -42,21 +42,12 @@ def get_upscale_finegrain(prompt, img_path, upscale_factor):
42
  return None
43
 
44
  async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
45
- model = enable_lora(lora_model, basemodel) if process_lora else basemodel
46
- image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
47
- if image is None:
48
- return [None, None]
49
-
50
- image_path = "temp_image.jpg"
51
- image.save(image_path, format="JPEG")
52
-
53
  if process_upscale:
54
- upscale_image = get_upscale_finegrain(prompt, image_path, upscale_factor)
55
- upscale_image_path = "upscale_image.jpg"
56
- upscale_image.save(upscale_image_path, format="JPEG")
57
- return [image_path, upscale_image_path]
58
- else:
59
- return [image_path, image_path]
60
 
61
  css = """
62
  #col-container{ margin: 0 auto; max-width: 1024px;}
 
42
  return None
43
 
44
  async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
45
+ ...
 
 
 
 
 
 
 
46
  if process_upscale:
47
+ upscale_image_path = get_upscale_finegrain(prompt, image_path, upscale_factor)
48
+ upscale_image = Image.open(upscale_image_path) # Abrir la imagen utilizando PIL
49
+ upscale_image.save("upscale_image.jpg", format="JPEG") # Guardar la imagen
50
+ return [image_path, "upscale_image.jpg"]
 
 
51
 
52
  css = """
53
  #col-container{ margin: 0 auto; max-width: 1024px;}