Spaces:
Running
Running
Commit
·
ad4ca82
1
Parent(s):
7d6b1f5
8 loras added
Browse files
__pycache__/video_config.cpython-311.pyc
CHANGED
Binary files a/__pycache__/video_config.cpython-311.pyc and b/__pycache__/video_config.cpython-311.pyc differ
|
|
__pycache__/workflow_handler.cpython-311.pyc
CHANGED
Binary files a/__pycache__/workflow_handler.cpython-311.pyc and b/__pycache__/workflow_handler.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -43,6 +43,36 @@ loras = [
|
|
43 |
"title": "Cakeify",
|
44 |
"example_prompt": "The video opens on a woman. A knife, held by a hand, is coming into frame and hovering over the woman. The knife then begins cutting into the woman to c4k3 cakeify it. As the knife slices the woman open, the inside of the woman is revealed to be cake with chocolate layers. The knife cuts through and the contents of the woman are revealed."
|
45 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
|
@@ -159,8 +189,46 @@ def build_lora_prompt(subject, lora_id):
|
|
159 |
f"and the contents of the {subject} are revealed."
|
160 |
)
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
else:
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
def poll_generation_status(generation_id):
|
166 |
"""Poll generation status from database"""
|
@@ -268,7 +336,39 @@ def update_selection(evt: gr.SelectData):
|
|
268 |
sentence = f"Selected LoRA: {selected_lora['title']}"
|
269 |
return selected_lora['id'], sentence
|
270 |
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
try:
|
273 |
if selected_index is None:
|
274 |
raise gr.Error("You must select a LoRA before proceeding.")
|
@@ -432,11 +532,63 @@ css = '''
|
|
432 |
color: #e0e0e0;
|
433 |
font-weight: bold;
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
'''
|
436 |
|
437 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", neutral_hue="slate", text_size="lg")) as demo:
|
438 |
selected_index = gr.State(None)
|
439 |
current_generation_id = gr.State(None)
|
|
|
440 |
|
441 |
gr.Markdown("# Remade AI - Wan 2.1 I2V effects LoRAs ")
|
442 |
|
@@ -467,11 +619,35 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", neutral_hue="
|
|
467 |
# Discord feature callout for LoRAs with better contrast
|
468 |
gr.HTML(
|
469 |
"""<div class="discord-feature">
|
470 |
-
<span class="discord-feature-title">✨ Discord Members:</span> Access 100+ additional LoRAs beyond these
|
471 |
</div>"""
|
472 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
-
input_image = gr.Image(type="filepath")
|
475 |
subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
|
476 |
|
477 |
# Modified duration options - only one active option
|
@@ -519,8 +695,14 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", neutral_hue="
|
|
519 |
outputs=[selected_index, selected_info]
|
520 |
)
|
521 |
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
# Add a custom handler to check if inputs are valid
|
523 |
-
def check_inputs(subject, input_image, selected_index):
|
524 |
if not selected_index:
|
525 |
return gr.Error("You must select a LoRA before proceeding.")
|
526 |
if not subject.strip():
|
@@ -532,11 +714,11 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", neutral_hue="
|
|
532 |
# Use gr.on for the button click with validation
|
533 |
button.click(
|
534 |
fn=check_inputs,
|
535 |
-
inputs=[subject, input_image, selected_index],
|
536 |
outputs=None
|
537 |
).success(
|
538 |
fn=handle_generation,
|
539 |
-
inputs=[input_image, subject, duration, selected_index],
|
540 |
outputs=[output, current_generation_id, progress_bar]
|
541 |
)
|
542 |
|
|
|
43 |
"title": "Cakeify",
|
44 |
"example_prompt": "The video opens on a woman. A knife, held by a hand, is coming into frame and hovering over the woman. The knife then begins cutting into the woman to c4k3 cakeify it. As the knife slices the woman open, the inside of the woman is revealed to be cake with chocolate layers. The knife cuts through and the contents of the woman are revealed."
|
45 |
},
|
46 |
+
{
|
47 |
+
"image": "https://huggingface.co/Remade-AI/Muscle/resolve/main/example_videos/man2_muscle.gif",
|
48 |
+
"id": "3c6fd399-e558-43fa-8cd3-828300aac6f8",
|
49 |
+
"title": "Muscle",
|
50 |
+
"example_prompt": "A man t2k1s takes off clothes revealing a lean muscular body and shows off muscles, looking towards the camera."
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"image": "https://storage.googleapis.com/remade-v2/huggingface_assets/crush_example.gif",
|
54 |
+
"id": "d8a2912b-94e4-4227-9c45-356679af34fd",
|
55 |
+
"title": "Crush",
|
56 |
+
"example_prompt": "The video begins with a cube saying closed source. A hydraulic press positioned above slowly descends towards the cube. Upon contact, the hydraulic press c5us4 crushes it, deforming and flattening the cube, causing the cube to collapse inward until the cube is no longer recognizable."
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"image": "https://storage.googleapis.com/remade-v2/huggingface_assets/decay_example.gif",
|
60 |
+
"id": "3c6fd399-e558-43fa-8cd3-828300aac6f8",
|
61 |
+
"title": "Decay",
|
62 |
+
"example_prompt": "The video shows a man. The d3c4y decay time-lapse begins, causing the man to change. The man is initially whole, but soon he appears to be rotting. The man slowly becomes increasingly shriveled and discolored, and eventually, the man decomposes and falls apart. The man is rotting in the center and appears to be covered in mold, completing the d3c4y decay time-lapse."
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"image": "https://storage.googleapis.com/remade-v2/huggingface_assets/jesus_example.gif",
|
66 |
+
"id": "615fe106-fec4-44bb-b28b-2864cb322027",
|
67 |
+
"title": "Jesus",
|
68 |
+
"example_prompt": "The video begins with a smiling woman with a pink shirt looking at the camera. Then jesus appears behind her as h54g hugs jesus. Jesus embraces the woman, and they both smile in front of a park."
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"image": "https://storage.googleapis.com/remade-v2/huggingface_assets/inflate_example.gif",
|
72 |
+
"id": "da2b1c34-7be8-4161-a733-e8b19a98901c",
|
73 |
+
"title": "Inflate",
|
74 |
+
"example_prompt": "The large, bald man rides a gray donkey, then infl4t3 inflates it, both the man and the donkey expanding into giant, inflated figures against the desert landscape."
|
75 |
+
},
|
76 |
|
77 |
|
78 |
|
|
|
189 |
f"and the contents of the {subject} are revealed."
|
190 |
)
|
191 |
|
192 |
+
elif lora_id == "3c6fd399-e558-43fa-8cd3-828300aac6f8": # Muscle
|
193 |
+
return (
|
194 |
+
f"A {subject} t2k1s takes off clothes revealing a lean muscular body and shows off muscles, "
|
195 |
+
f"looking towards the camera."
|
196 |
+
)
|
197 |
+
|
198 |
+
elif lora_id == "d8a2912b-94e4-4227-9c45-356679af34fd": # Crush
|
199 |
+
return (
|
200 |
+
f"The video begins with a {subject}. A hydraulic press positioned above slowly descends "
|
201 |
+
f"towards the {subject}. Upon contact, the hydraulic press c5us4 crushes it, deforming and "
|
202 |
+
f"flattening the {subject}, causing the {subject} to collapse inward until the {subject} is "
|
203 |
+
f"no longer recognizable."
|
204 |
+
)
|
205 |
+
|
206 |
+
elif lora_id == "3c6fd399-e558-43fa-8cd3-828300aac6f8": # Decay
|
207 |
+
return (
|
208 |
+
f"The video shows a {subject}. The d3c4y decay time-lapse begins, causing the {subject} to change. "
|
209 |
+
f"The {subject} is initially whole, but soon it appears to be rotting. The {subject} slowly becomes "
|
210 |
+
f"increasingly shriveled and discolored, and eventually, the {subject} decomposes and falls apart. "
|
211 |
+
f"The {subject} is rotting in the center and appears to be covered in mold, completing the d3c4y decay time-lapse."
|
212 |
+
)
|
213 |
+
|
214 |
+
elif lora_id == "615fe106-fec4-44bb-b28b-2864cb322027": # Jesus
|
215 |
+
return (
|
216 |
+
f"The video begins with a {subject} looking at the camera. Then jesus appears behind the {subject} "
|
217 |
+
f"as h54g hugs jesus. Jesus embraces the {subject}, and they both smile."
|
218 |
+
)
|
219 |
+
|
220 |
+
elif lora_id == "da2b1c34-7be8-4161-a733-e8b19a98901c": # Inflate
|
221 |
+
return (
|
222 |
+
f"The {subject} infl4t3 inflates, expanding into a giant, inflated figure."
|
223 |
+
)
|
224 |
+
|
225 |
else:
|
226 |
+
# Fallback to using the example prompt from the LoRA config
|
227 |
+
if "example_prompt" in lora_config:
|
228 |
+
# Replace any specific subject in the example with the user's subject
|
229 |
+
return lora_config["example_prompt"].replace("rodent", subject).replace("woman", subject).replace("man", subject)
|
230 |
+
else:
|
231 |
+
raise ValueError(f"Unknown LoRA ID: {lora_id} and no example prompt available")
|
232 |
|
233 |
def poll_generation_status(generation_id):
|
234 |
"""Poll generation status from database"""
|
|
|
336 |
sentence = f"Selected LoRA: {selected_lora['title']}"
|
337 |
return selected_lora['id'], sentence
|
338 |
|
339 |
+
def select_example_image(evt: gr.SelectData):
|
340 |
+
"""Handle example image selection and return image URL and description"""
|
341 |
+
example_images = [
|
342 |
+
{
|
343 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_1c2c6e4c-8938-4464-9355-84508bcca24e.jpg",
|
344 |
+
"description": "Old man"
|
345 |
+
},
|
346 |
+
{
|
347 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_1f2c6ec9-823f-46d2-982f-73c494e51877.jpg",
|
348 |
+
"description": "Young woman"
|
349 |
+
},
|
350 |
+
{
|
351 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_24d949f0-8699-4714-9c82-854e1b963063.jpg",
|
352 |
+
"description": "Puppy"
|
353 |
+
},
|
354 |
+
{
|
355 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_af26651e-be1a-40c0-be18-c42b3bf6d211.png",
|
356 |
+
"description": "Mini toy dancers"
|
357 |
+
},
|
358 |
+
{
|
359 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_d22a894e-a074-4742-9e23-787f001a3184.jpg",
|
360 |
+
"description": "Chair"
|
361 |
+
},
|
362 |
+
{
|
363 |
+
"url": "https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_e6472106-4e9d-4620-b41b-a9bbe4893415.png",
|
364 |
+
"description": "Cartoon boy on bike"
|
365 |
+
}
|
366 |
+
]
|
367 |
+
|
368 |
+
selected = example_images[evt.index]
|
369 |
+
return selected["url"], selected["description"]
|
370 |
+
|
371 |
+
async def handle_generation(input_image, subject, duration, selected_index, selected_example_url, progress=gr.Progress(track_tqdm=True)):
|
372 |
try:
|
373 |
if selected_index is None:
|
374 |
raise gr.Error("You must select a LoRA before proceeding.")
|
|
|
532 |
color: #e0e0e0;
|
533 |
font-weight: bold;
|
534 |
}
|
535 |
+
|
536 |
+
/* Example images and upload section styling */
|
537 |
+
.upload-section {
|
538 |
+
display: flex;
|
539 |
+
gap: 20px;
|
540 |
+
margin: 20px 0;
|
541 |
+
}
|
542 |
+
|
543 |
+
.example-images-container {
|
544 |
+
flex: 1;
|
545 |
+
}
|
546 |
+
|
547 |
+
.upload-container {
|
548 |
+
flex: 1;
|
549 |
+
display: flex;
|
550 |
+
flex-direction: column;
|
551 |
+
justify-content: center;
|
552 |
+
}
|
553 |
+
|
554 |
+
.section-title {
|
555 |
+
font-weight: bold;
|
556 |
+
margin-bottom: 10px;
|
557 |
+
color: #7289DA;
|
558 |
+
}
|
559 |
+
|
560 |
+
.example-images-grid {
|
561 |
+
display: grid;
|
562 |
+
grid-template-columns: repeat(3, 1fr);
|
563 |
+
gap: 10px;
|
564 |
+
}
|
565 |
+
|
566 |
+
.example-image-item {
|
567 |
+
border-radius: 8px;
|
568 |
+
overflow: hidden;
|
569 |
+
cursor: pointer;
|
570 |
+
transition: all 0.2s ease;
|
571 |
+
border: 2px solid transparent;
|
572 |
+
}
|
573 |
+
|
574 |
+
.example-image-item:hover {
|
575 |
+
transform: scale(1.05);
|
576 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
577 |
+
}
|
578 |
+
|
579 |
+
.example-image-item.selected {
|
580 |
+
border-color: #7289DA;
|
581 |
+
}
|
582 |
+
|
583 |
+
.upload-button {
|
584 |
+
margin-top: 15px;
|
585 |
+
}
|
586 |
'''
|
587 |
|
588 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", neutral_hue="slate", text_size="lg")) as demo:
|
589 |
selected_index = gr.State(None)
|
590 |
current_generation_id = gr.State(None)
|
591 |
+
selected_example_url = gr.State(None)
|
592 |
|
593 |
gr.Markdown("# Remade AI - Wan 2.1 I2V effects LoRAs ")
|
594 |
|
|
|
619 |
# Discord feature callout for LoRAs with better contrast
|
620 |
gr.HTML(
|
621 |
"""<div class="discord-feature">
|
622 |
+
<span class="discord-feature-title">✨ Discord Members:</span> Access 100+ additional LoRAs beyond these 8 samples!
|
623 |
</div>"""
|
624 |
)
|
625 |
+
|
626 |
+
gr.HTML('<div class="section-description">Click an example image or upload your own</div>')
|
627 |
+
|
628 |
+
# Reorganized image input section - example images and upload side by side
|
629 |
+
with gr.Row():
|
630 |
+
with gr.Column(scale=1):
|
631 |
+
|
632 |
+
example_gallery = gr.Gallery(
|
633 |
+
[
|
634 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_1c2c6e4c-8938-4464-9355-84508bcca24e.jpg", "Old man"),
|
635 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_1f2c6ec9-823f-46d2-982f-73c494e51877.jpg", "Young woman"),
|
636 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_24d949f0-8699-4714-9c82-854e1b963063.jpg", "Puppy"),
|
637 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_af26651e-be1a-40c0-be18-c42b3bf6d211.png", "Mini toy dancers"),
|
638 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_d22a894e-a074-4742-9e23-787f001a3184.jpg", "Chair"),
|
639 |
+
("https://storage.googleapis.com/remade-v2/huggingface_assets/uploads_e6472106-4e9d-4620-b41b-a9bbe4893415.png", "Cartoon boy on bike")
|
640 |
+
],
|
641 |
+
columns=3,
|
642 |
+
height="300px",
|
643 |
+
object_fit="cover"
|
644 |
+
)
|
645 |
+
|
646 |
+
|
647 |
+
with gr.Column(scale=1):
|
648 |
+
|
649 |
+
input_image = gr.Image(type="filepath", label="")
|
650 |
|
|
|
651 |
subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
|
652 |
|
653 |
# Modified duration options - only one active option
|
|
|
695 |
outputs=[selected_index, selected_info]
|
696 |
)
|
697 |
|
698 |
+
# Connect example gallery selection to subject and selected_example_url
|
699 |
+
example_gallery.select(
|
700 |
+
fn=select_example_image,
|
701 |
+
outputs=[selected_example_url, subject]
|
702 |
+
)
|
703 |
+
|
704 |
# Add a custom handler to check if inputs are valid
|
705 |
+
def check_inputs(subject, input_image, selected_index, selected_example_url):
|
706 |
if not selected_index:
|
707 |
return gr.Error("You must select a LoRA before proceeding.")
|
708 |
if not subject.strip():
|
|
|
714 |
# Use gr.on for the button click with validation
|
715 |
button.click(
|
716 |
fn=check_inputs,
|
717 |
+
inputs=[subject, input_image, selected_index, selected_example_url],
|
718 |
outputs=None
|
719 |
).success(
|
720 |
fn=handle_generation,
|
721 |
+
inputs=[input_image, subject, duration, selected_index, selected_example_url],
|
722 |
outputs=[output, current_generation_id, progress_bar]
|
723 |
)
|
724 |
|