Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -161,6 +161,7 @@ script_directory = os.path.dirname(os.path.realpath(__file__))
|
|
161 |
preset_template = glob.glob("./images/templates/*.png")
|
162 |
preset_template = preset_template + glob.glob("./images/templates/*.jpg")
|
163 |
|
|
|
164 |
with gr.Blocks(title="ConsistentID_SDXL Demo") as demo:
|
165 |
gr.Markdown("# ConsistentID_SDXL Demo")
|
166 |
gr.Markdown("\
|
@@ -171,7 +172,6 @@ with gr.Blocks(title="ConsistentID_SDXL Demo") as demo:
|
|
171 |
with gr.Row():
|
172 |
with gr.Column():
|
173 |
model_selected_tab = gr.State(0)
|
174 |
-
|
175 |
with gr.TabItem("template images") as template_images_tab:
|
176 |
template_gallery_list = [(i, i) for i in preset_template]
|
177 |
gallery = gr.Gallery(template_gallery_list,columns=[4], rows=[2], object_fit="contain", height="auto",show_label=False)
|
@@ -180,21 +180,10 @@ with gr.Blocks(title="ConsistentID_SDXL Demo") as demo:
|
|
180 |
return preset_template[evt.index]
|
181 |
|
182 |
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
|
|
183 |
gallery.select(select_function, None, selected_template_images)
|
184 |
-
print(selected_template_images)
|
185 |
-
|
186 |
with gr.TabItem("Upload Image") as upload_image_tab:
|
187 |
-
costum_image = gr.Image(label="Upload Image")
|
188 |
-
|
189 |
-
### Obtain the image_path
|
190 |
-
def handle_uploaded_image(image):
|
191 |
-
if image:
|
192 |
-
return f"Uploaded image path: {image}"
|
193 |
-
return "No image uploaded."
|
194 |
-
|
195 |
-
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
196 |
-
costum_image.change(handle_uploaded_image, inputs=costum_image, outputs=selected_template_images)
|
197 |
-
print(selected_template_images)
|
198 |
|
199 |
model_selected_tabs = [template_images_tab, upload_image_tab]
|
200 |
for i, tab in enumerate(model_selected_tabs):
|
|
|
161 |
preset_template = glob.glob("./images/templates/*.png")
|
162 |
preset_template = preset_template + glob.glob("./images/templates/*.jpg")
|
163 |
|
164 |
+
|
165 |
with gr.Blocks(title="ConsistentID_SDXL Demo") as demo:
|
166 |
gr.Markdown("# ConsistentID_SDXL Demo")
|
167 |
gr.Markdown("\
|
|
|
172 |
with gr.Row():
|
173 |
with gr.Column():
|
174 |
model_selected_tab = gr.State(0)
|
|
|
175 |
with gr.TabItem("template images") as template_images_tab:
|
176 |
template_gallery_list = [(i, i) for i in preset_template]
|
177 |
gallery = gr.Gallery(template_gallery_list,columns=[4], rows=[2], object_fit="contain", height="auto",show_label=False)
|
|
|
180 |
return preset_template[evt.index]
|
181 |
|
182 |
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
183 |
+
print(f"=========selected_template_images : {selected_template_images}=============== \r\n ")
|
184 |
gallery.select(select_function, None, selected_template_images)
|
|
|
|
|
185 |
with gr.TabItem("Upload Image") as upload_image_tab:
|
186 |
+
costum_image = gr.Image(label="Upload Image")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
model_selected_tabs = [template_images_tab, upload_image_tab]
|
189 |
for i, tab in enumerate(model_selected_tabs):
|