Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -300,7 +300,7 @@ def add_custom_lora(custom_lora):
|
|
| 300 |
</div>
|
| 301 |
'''
|
| 302 |
existing_item_index = next((index for (index, item) in enumerate(loras) if item['repo'] == repo), None)
|
| 303 |
-
if
|
| 304 |
new_item = {
|
| 305 |
"image": image,
|
| 306 |
"title": title,
|
|
@@ -309,8 +309,8 @@ def add_custom_lora(custom_lora):
|
|
| 309 |
"trigger_word": trigger_word
|
| 310 |
}
|
| 311 |
print(new_item)
|
| 312 |
-
existing_item_index = len(loras)
|
| 313 |
loras.append(new_item)
|
|
|
|
| 314 |
|
| 315 |
return gr.update(visible=True, value=card), gr.update(visible=True), gr.Gallery(selected_index=None), f"Custom: {path}", existing_item_index, trigger_word
|
| 316 |
except Exception as e:
|
|
@@ -340,8 +340,7 @@ css = '''
|
|
| 340 |
|
| 341 |
with gr.Blocks(theme=gr.themes.Soft(), css=css, delete_cache=(60, 60)) as app:
|
| 342 |
title = gr.HTML(
|
| 343 |
-
"""<h1><img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image" style="vertical-align: middle;">
|
| 344 |
-
<br>LoRA Explorer</h1>""",
|
| 345 |
elem_id="title",
|
| 346 |
)
|
| 347 |
|
|
|
|
| 300 |
</div>
|
| 301 |
'''
|
| 302 |
existing_item_index = next((index for (index, item) in enumerate(loras) if item['repo'] == repo), None)
|
| 303 |
+
if existing_item_index is None:
|
| 304 |
new_item = {
|
| 305 |
"image": image,
|
| 306 |
"title": title,
|
|
|
|
| 309 |
"trigger_word": trigger_word
|
| 310 |
}
|
| 311 |
print(new_item)
|
|
|
|
| 312 |
loras.append(new_item)
|
| 313 |
+
existing_item_index = len(loras) - 1 # Get the actual index after adding
|
| 314 |
|
| 315 |
return gr.update(visible=True, value=card), gr.update(visible=True), gr.Gallery(selected_index=None), f"Custom: {path}", existing_item_index, trigger_word
|
| 316 |
except Exception as e:
|
|
|
|
| 340 |
|
| 341 |
with gr.Blocks(theme=gr.themes.Soft(), css=css, delete_cache=(60, 60)) as app:
|
| 342 |
title = gr.HTML(
|
| 343 |
+
"""<h1><img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image" style="height: 100px; margin-right: 10px; vertical-align: middle;"> Qwen-Image LoRA Explorer</h1>""",
|
|
|
|
| 344 |
elem_id="title",
|
| 345 |
)
|
| 346 |
|