Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,7 @@ from pipeline_stable_diffusion_xl_instantid_img2img import StableDiffusionXLInst
|
|
| 28 |
from controlnet_aux import ZoeDetector
|
| 29 |
|
| 30 |
from compel import Compel, ReturnedEmbeddingsType
|
|
|
|
| 31 |
|
| 32 |
with open("sdxl_loras.json", "r") as file:
|
| 33 |
data = json.load(file)
|
|
@@ -175,7 +176,7 @@ def center_crop_image_as_square(img):
|
|
| 175 |
bottom = (img.height + square_size) / 2
|
| 176 |
|
| 177 |
img_cropped = img.crop((left, top, right, bottom))
|
| 178 |
-
return img_cropped
|
| 179 |
|
| 180 |
def check_selected(selected_state):
|
| 181 |
if not selected_state:
|
|
@@ -295,7 +296,7 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, face_stre
|
|
| 295 |
).images[0]
|
| 296 |
last_lora = repo_name
|
| 297 |
gc.collect()
|
| 298 |
-
return image, gr.update(visible=True)
|
| 299 |
|
| 300 |
def shuffle_gallery(sdxl_loras):
|
| 301 |
random.shuffle(sdxl_loras)
|
|
@@ -322,7 +323,7 @@ with gr.Blocks(css="custom.css") as demo:
|
|
| 322 |
with gr.Row(elem_id="main_app"):
|
| 323 |
with gr.Column(scale=3)
|
| 324 |
with gr.Group(elem_id="gallery_box"):
|
| 325 |
-
photo =
|
| 326 |
selected_loras = gr.Gallery(label="Selected LoRAs", height=80, show_share_button=False, visible=False, elem_id="gallery_selected", )
|
| 327 |
order_gallery = gr.Radio(choices=["random", "likes"], value="random", label="Order by", elem_id="order_radio")
|
| 328 |
#new_gallery = gr.Gallery(
|
|
|
|
| 28 |
from controlnet_aux import ZoeDetector
|
| 29 |
|
| 30 |
from compel import Compel, ReturnedEmbeddingsType
|
| 31 |
+
from gradio_imageslider import ImageSlider
|
| 32 |
|
| 33 |
with open("sdxl_loras.json", "r") as file:
|
| 34 |
data = json.load(file)
|
|
|
|
| 176 |
bottom = (img.height + square_size) / 2
|
| 177 |
|
| 178 |
img_cropped = img.crop((left, top, right, bottom))
|
| 179 |
+
return (img_cropped, None)
|
| 180 |
|
| 181 |
def check_selected(selected_state):
|
| 182 |
if not selected_state:
|
|
|
|
| 296 |
).images[0]
|
| 297 |
last_lora = repo_name
|
| 298 |
gc.collect()
|
| 299 |
+
return (face_image, image), gr.update(visible=True)
|
| 300 |
|
| 301 |
def shuffle_gallery(sdxl_loras):
|
| 302 |
random.shuffle(sdxl_loras)
|
|
|
|
| 323 |
with gr.Row(elem_id="main_app"):
|
| 324 |
with gr.Column(scale=3)
|
| 325 |
with gr.Group(elem_id="gallery_box"):
|
| 326 |
+
photo = ImageSlider(label="Upload a picture of yourself", interactive=True, type="pil")
|
| 327 |
selected_loras = gr.Gallery(label="Selected LoRAs", height=80, show_share_button=False, visible=False, elem_id="gallery_selected", )
|
| 328 |
order_gallery = gr.Radio(choices=["random", "likes"], value="random", label="Order by", elem_id="order_radio")
|
| 329 |
#new_gallery = gr.Gallery(
|