Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -171,6 +171,7 @@ 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 |
with gr.TabItem("template images") as template_images_tab:
|
175 |
template_gallery_list = [(i, i) for i in preset_template]
|
176 |
gallery = gr.Gallery(template_gallery_list,columns=[4], rows=[2], object_fit="contain", height="auto",show_label=False)
|
@@ -179,19 +180,21 @@ with gr.Blocks(title="ConsistentID_SDXL Demo") as demo:
|
|
179 |
return preset_template[evt.index]
|
180 |
|
181 |
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
182 |
-
|
|
|
183 |
|
184 |
with gr.TabItem("Upload Image") as upload_image_tab:
|
185 |
-
costum_image = gr.Image(label="Upload Image")
|
186 |
|
187 |
-
###
|
188 |
def handle_uploaded_image(image):
|
189 |
if image:
|
190 |
return f"Uploaded image path: {image}"
|
191 |
-
return "No image uploaded."
|
192 |
-
|
193 |
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
194 |
-
|
|
|
195 |
|
196 |
model_selected_tabs = [template_images_tab, upload_image_tab]
|
197 |
for i, tab in enumerate(model_selected_tabs):
|
|
|
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 |
return preset_template[evt.index]
|
181 |
|
182 |
selected_template_images = gr.Text(show_label=False, visible=False, placeholder="Selected")
|
183 |
+
costum_image.change(handle_uploaded_image, inputs=costum_image, outputs=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):
|