Spaces:
Sleeping
Sleeping
Add image files using Git LFS
Browse files- Movie Pose Style/Option 1/clip-f.png +3 -0
- Movie Pose Style/Option 1/clip-m.png +3 -0
- Movie Pose Style/Option 1/image.png +3 -0
- Movie Pose Style/Option 1/man1.png +3 -0
- Movie Pose Style/Option 1/woman1.png +3 -0
- Movie Pose Style/Option 2/clip-f.png +3 -0
- Movie Pose Style/Option 2/clip-m.png +3 -0
- Movie Pose Style/Option 2/image.png +3 -0
- Movie Pose Style/Option 2/man2.png +3 -0
- Movie Pose Style/Option 2/woman2.png +3 -0
- Movie Pose Style/Option 3/clip-f.png +3 -0
- Movie Pose Style/Option 3/clip-m.png +3 -0
- Movie Pose Style/Option 3/image.png +3 -0
- Movie Pose Style/Option 3/man3.png +3 -0
- Movie Pose Style/Option 3/woman3.png +3 -0
- Movie Pose Style/Option 4/clip-f.png +3 -0
- Movie Pose Style/Option 4/clip-m.png +3 -0
- Movie Pose Style/Option 4/image.png +3 -0
- Movie Pose Style/Option 4/man4.png +3 -0
- Movie Pose Style/Option 4/woman4.png +3 -0
- Movie Pose Style/Option 5/clip-f.png +3 -0
- Movie Pose Style/Option 5/clip-m.png +3 -0
- Movie Pose Style/Option 5/image.png +3 -0
- Movie Pose Style/Option 5/man5.png +3 -0
- Movie Pose Style/Option 5/woman5.png +3 -0
- Movie Pose Style/Option 6/clip-f.png +3 -0
- Movie Pose Style/Option 6/clip-m.png +3 -0
- Movie Pose Style/Option 6/image.png +3 -0
- Movie Pose Style/Option 6/man6.png +3 -0
- Movie Pose Style/Option 6/woman6.png +3 -0
- app copy.py +94 -0
- app.py +45 -11
- install +17 -0
- test_images/clipspace-mask-4722992.png +0 -0
- test_images/clipspace-mask-4736783.png +0 -0
- test_images/man.png +0 -0
- test_images/woman.png +0 -0
- test_images/user3-f.jpg → user3-f.jpg +0 -0
- test_images/user3.jpg → user3-m.jpg +0 -0
Movie Pose Style/Option 1/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 1/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 1/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 1/man1.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 1/woman1.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 2/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 2/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 2/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 2/man2.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 2/woman2.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 3/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 3/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 3/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 3/man3.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 3/woman3.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 4/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 4/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 4/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 4/man4.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 4/woman4.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 5/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 5/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 5/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 5/man5.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 5/woman5.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 6/clip-f.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 6/clip-m.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 6/image.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 6/man6.png
ADDED
![]() |
Git LFS Details
|
Movie Pose Style/Option 6/woman6.png
ADDED
![]() |
Git LFS Details
|
app copy.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import asyncio
|
3 |
+
import fal_client
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
import os
|
6 |
+
from pathlib import Path
|
7 |
+
import time
|
8 |
+
|
9 |
+
load_dotenv()
|
10 |
+
os.environ["FAL_KEY"] = os.getenv("FAL_API_KEY")
|
11 |
+
|
12 |
+
async def generate_paris_images(image1_path: str, image2_path: str, woman_prompt: str, man_prompt: str, batch_size: int, progress=gr.Progress()):
|
13 |
+
start_time = time.time()
|
14 |
+
print("Progress: 5% - Starting Paris image generation...")
|
15 |
+
progress(0.05, desc="Starting Paris image generation...")
|
16 |
+
|
17 |
+
# Upload all images in parallel
|
18 |
+
upload_tasks = [
|
19 |
+
fal_client.upload_file_async(str(image1_path)),
|
20 |
+
fal_client.upload_file_async(str(image2_path)),
|
21 |
+
fal_client.upload_file_async("test_images/woman.png"),
|
22 |
+
fal_client.upload_file_async("test_images/man.png"),
|
23 |
+
fal_client.upload_file_async("test_images/clipspace-mask-4736783.png"),
|
24 |
+
fal_client.upload_file_async("test_images/clipspace-mask-4722992.png")
|
25 |
+
]
|
26 |
+
|
27 |
+
[image1_url, image2_url, woman_img, man_img, mask1_img, mask2_img] = await asyncio.gather(*upload_tasks)
|
28 |
+
|
29 |
+
print("Progress: 40% - Uploaded all images")
|
30 |
+
progress(0.4, desc="Uploaded all images")
|
31 |
+
|
32 |
+
handler = await fal_client.submit_async(
|
33 |
+
"comfy/LVE/paris-couple",
|
34 |
+
arguments={
|
35 |
+
"loadimage_1": image1_url,
|
36 |
+
"loadimage_2": image2_url,
|
37 |
+
"loadimage_3": woman_img,
|
38 |
+
"loadimage_4": mask1_img,
|
39 |
+
"loadimage_5": mask2_img,
|
40 |
+
"loadimage_6": man_img,
|
41 |
+
"woman_prompt": woman_prompt,
|
42 |
+
"man_prompt": man_prompt,
|
43 |
+
"batch_size": batch_size
|
44 |
+
}
|
45 |
+
)
|
46 |
+
|
47 |
+
print("Progress: 60% - Processing images...")
|
48 |
+
progress(0.6, desc="Processing images...")
|
49 |
+
|
50 |
+
result = await handler.get()
|
51 |
+
print(result)
|
52 |
+
|
53 |
+
end_time = time.time()
|
54 |
+
processing_time = end_time - start_time
|
55 |
+
print(f"Progress: 100% - Generation completed in {processing_time:.2f} seconds")
|
56 |
+
progress(1.0, desc=f"Generation completed in {processing_time:.2f} seconds")
|
57 |
+
|
58 |
+
# Return all generated image URLs and processing time
|
59 |
+
# Get the first key from outputs dynamically
|
60 |
+
return (
|
61 |
+
[img["url"] for img in result["outputs"][next(iter(result["outputs"]))]["images"]] if "outputs" in result and result["outputs"] else [],
|
62 |
+
f"Processing time: {processing_time:.2f} seconds"
|
63 |
+
)
|
64 |
+
|
65 |
+
with gr.Blocks() as demo:
|
66 |
+
with gr.Row():
|
67 |
+
image1_input = gr.Image(label="Upload Woman Image", type="filepath", value="test_images/user3-f.jpg")
|
68 |
+
image2_input = gr.Image(label="Upload Man Image", type="filepath", value="test_images/user3.jpg")
|
69 |
+
|
70 |
+
with gr.Row():
|
71 |
+
woman_prompt = gr.Textbox(
|
72 |
+
label="Woman Prompt",
|
73 |
+
value="Close-up, portrait photo, a woman, Paris nighttime romance scene, wearing an elegant black dress with a shawl, standing beneath the same canopy of twinkling lights along the Champs-Élysées, the Eiffel Tower glowing bright in the distance, soft mist rising from the street, looking at the camera."
|
74 |
+
)
|
75 |
+
man_prompt = gr.Textbox(
|
76 |
+
label="Man Prompt",
|
77 |
+
value="Close-up, portrait photo, a man, Paris nighttime romance scene, wearing a tailored suit with a crisp white shirt, standing beneath a canopy of twinkling lights along the Champs-Élysées, the Eiffel Tower glowing bright in the distance, soft mist rising from the street, looking at the camera."
|
78 |
+
)
|
79 |
+
|
80 |
+
batch_size = gr.Slider(minimum=1, maximum=8, value=4, step=1, label="Batch Size")
|
81 |
+
|
82 |
+
generate_btn = gr.Button("Generate")
|
83 |
+
image_output = gr.Gallery(label="Generated Image")
|
84 |
+
time_output = gr.Textbox(label="Processing Time")
|
85 |
+
|
86 |
+
generate_btn.click(
|
87 |
+
fn=generate_paris_images,
|
88 |
+
inputs=[image1_input, image2_input, woman_prompt, man_prompt, batch_size],
|
89 |
+
outputs=[image_output, time_output]
|
90 |
+
)
|
91 |
+
|
92 |
+
if __name__ == "__main__":
|
93 |
+
print("Starting Gradio interface...")
|
94 |
+
demo.launch()
|
app.py
CHANGED
@@ -9,22 +9,33 @@ import time
|
|
9 |
load_dotenv()
|
10 |
os.environ["FAL_KEY"] = os.getenv("FAL_API_KEY")
|
11 |
|
12 |
-
async def generate_paris_images(image1_path: str, image2_path: str, woman_prompt: str, man_prompt: str, batch_size: int, progress=gr.Progress()):
|
13 |
start_time = time.time()
|
14 |
print("Progress: 5% - Starting Paris image generation...")
|
15 |
progress(0.05, desc="Starting Paris image generation...")
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# Upload all images in parallel
|
18 |
upload_tasks = [
|
19 |
fal_client.upload_file_async(str(image1_path)),
|
20 |
fal_client.upload_file_async(str(image2_path)),
|
21 |
-
fal_client.upload_file_async(
|
22 |
-
fal_client.upload_file_async(
|
23 |
-
fal_client.upload_file_async(
|
24 |
-
fal_client.upload_file_async(
|
25 |
]
|
26 |
|
27 |
-
[image1_url, image2_url,
|
28 |
|
29 |
print("Progress: 40% - Uploaded all images")
|
30 |
progress(0.4, desc="Uploaded all images")
|
@@ -62,19 +73,36 @@ async def generate_paris_images(image1_path: str, image2_path: str, woman_prompt
|
|
62 |
f"Processing time: {processing_time:.2f} seconds"
|
63 |
)
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
with gr.Blocks() as demo:
|
66 |
with gr.Row():
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
with gr.Row():
|
71 |
woman_prompt = gr.Textbox(
|
72 |
label="Woman Prompt",
|
73 |
-
value="Close-up, portrait
|
74 |
)
|
75 |
man_prompt = gr.Textbox(
|
76 |
label="Man Prompt",
|
77 |
-
value="Close-up, portrait
|
78 |
)
|
79 |
|
80 |
batch_size = gr.Slider(minimum=1, maximum=8, value=4, step=1, label="Batch Size")
|
@@ -85,10 +113,16 @@ with gr.Blocks() as demo:
|
|
85 |
|
86 |
generate_btn.click(
|
87 |
fn=generate_paris_images,
|
88 |
-
inputs=[image1_input, image2_input, woman_prompt, man_prompt, batch_size],
|
89 |
outputs=[image_output, time_output]
|
90 |
)
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
if __name__ == "__main__":
|
93 |
print("Starting Gradio interface...")
|
94 |
demo.launch()
|
|
|
9 |
load_dotenv()
|
10 |
os.environ["FAL_KEY"] = os.getenv("FAL_API_KEY")
|
11 |
|
12 |
+
async def generate_paris_images(product_name: str, image1_path: str, image2_path: str, woman_prompt: str, man_prompt: str, batch_size: int, progress=gr.Progress()):
|
13 |
start_time = time.time()
|
14 |
print("Progress: 5% - Starting Paris image generation...")
|
15 |
progress(0.05, desc="Starting Paris image generation...")
|
16 |
|
17 |
+
product_number = product_name.split(" ")[1]
|
18 |
+
man_img = f"Movie Pose Style/Option {product_number}/man{product_number}.png"
|
19 |
+
woman_img = f"Movie Pose Style/Option {product_number}/woman{product_number}.png"
|
20 |
+
man_mask = f"Movie Pose Style/Option {product_number}/clip-m.png"
|
21 |
+
woman_mask = f"Movie Pose Style/Option {product_number}/clip-f.png"
|
22 |
+
|
23 |
+
print(f"man_img: {man_img}")
|
24 |
+
print(f"woman_img: {woman_img}")
|
25 |
+
print(f"man_mask: {man_mask}")
|
26 |
+
print(f"woman_mask: {woman_mask}")
|
27 |
+
|
28 |
# Upload all images in parallel
|
29 |
upload_tasks = [
|
30 |
fal_client.upload_file_async(str(image1_path)),
|
31 |
fal_client.upload_file_async(str(image2_path)),
|
32 |
+
fal_client.upload_file_async(man_img),
|
33 |
+
fal_client.upload_file_async(woman_img),
|
34 |
+
fal_client.upload_file_async(woman_mask),
|
35 |
+
fal_client.upload_file_async(man_mask)
|
36 |
]
|
37 |
|
38 |
+
[image1_url, image2_url, man_img, woman_img, mask1_img, mask2_img] = await asyncio.gather(*upload_tasks)
|
39 |
|
40 |
print("Progress: 40% - Uploaded all images")
|
41 |
progress(0.4, desc="Uploaded all images")
|
|
|
73 |
f"Processing time: {processing_time:.2f} seconds"
|
74 |
)
|
75 |
|
76 |
+
def change_product_preview(product_name):
|
77 |
+
if product_name == "Pose 1":
|
78 |
+
return "Movie Pose Style/Option 1/image.png"
|
79 |
+
elif product_name == "Pose 2":
|
80 |
+
return "Movie Pose Style/Option 2/image.png"
|
81 |
+
elif product_name == "Pose 3":
|
82 |
+
return "Movie Pose Style/Option 3/image.png"
|
83 |
+
elif product_name == "Pose 4":
|
84 |
+
return "Movie Pose Style/Option 4/image.png"
|
85 |
+
elif product_name == "Pose 5":
|
86 |
+
return "Movie Pose Style/Option 5/image.png"
|
87 |
+
elif product_name == "Pose 6":
|
88 |
+
return "Movie Pose Style/Option 6/image.png"
|
89 |
+
|
90 |
with gr.Blocks() as demo:
|
91 |
with gr.Row():
|
92 |
+
product_name = gr.Dropdown(label="Product Name", choices=["Pose 1", "Pose 2", "Pose 3", "Pose 4", "Pose 5", "Pose 6"], value="Pose 1")
|
93 |
+
product_preview = gr.Image(label="Product Preview", type="filepath", value="Movie Pose Style/Option 1/image.png", height=500, width=500)
|
94 |
+
with gr.Row():
|
95 |
+
image1_input = gr.Image(label="Upload Woman Image", type="filepath", value="user3-f.jpg")
|
96 |
+
image2_input = gr.Image(label="Upload Man Image", type="filepath", value="user3-m.jpg")
|
97 |
|
98 |
with gr.Row():
|
99 |
woman_prompt = gr.Textbox(
|
100 |
label="Woman Prompt",
|
101 |
+
value="Close-up, intimate portrait, a woman wearing a delicate pink floral embellished dress with a flowing tulle skirt, long blonde wavy hair cascading down her back, standing on the same snowy cobblestone street, the Eiffel Tower in the background, soft snowflakes falling around them, gentle streetlights casting a warm glow, her arms wrapped around her partner's neck, faces close together in an intimate moment, sharing a gentle smile."
|
102 |
)
|
103 |
man_prompt = gr.Textbox(
|
104 |
label="Man Prompt",
|
105 |
+
value="Close-up, intimate portrait, a man wearing a crisp white button-down shirt with rolled-up sleeves, khaki pants, standing on a snowy cobblestone street, the Eiffel Tower dusted with snow in the background, soft snowflakes falling around them, gentle streetlights casting a warm glow, his hands tenderly embracing his partner's waist, looking lovingly at her with a warm smile."
|
106 |
)
|
107 |
|
108 |
batch_size = gr.Slider(minimum=1, maximum=8, value=4, step=1, label="Batch Size")
|
|
|
113 |
|
114 |
generate_btn.click(
|
115 |
fn=generate_paris_images,
|
116 |
+
inputs=[product_name, image1_input, image2_input, woman_prompt, man_prompt, batch_size],
|
117 |
outputs=[image_output, time_output]
|
118 |
)
|
119 |
|
120 |
+
product_name.change(
|
121 |
+
fn=change_product_preview,
|
122 |
+
inputs=[product_name],
|
123 |
+
outputs=[product_preview]
|
124 |
+
)
|
125 |
+
|
126 |
if __name__ == "__main__":
|
127 |
print("Starting Gradio interface...")
|
128 |
demo.launch()
|
install
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[33mcommit 2b6ec1a4293a510a2f73c119ff575a44da8c4f3d[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mmain[m[33m)[m
|
2 |
+
Author: ardha <[email protected]>
|
3 |
+
Date: Thu Jan 23 21:32:00 2025 +0700
|
4 |
+
|
5 |
+
Add Git LFS tracking for PNG files
|
6 |
+
|
7 |
+
[33mcommit b6155c888b5c6746952225c40a5774ab49fee264[m
|
8 |
+
Author: ardha <[email protected]>
|
9 |
+
Date: Thu Jan 23 21:30:47 2025 +0700
|
10 |
+
|
11 |
+
Add Git LFS tracking for PNG files
|
12 |
+
|
13 |
+
[33mcommit 02fe2c9997ef77026be0f5ccfdfcf21d7e7e0d56[m
|
14 |
+
Author: ardha <[email protected]>
|
15 |
+
Date: Thu Jan 23 21:29:55 2025 +0700
|
16 |
+
|
17 |
+
product list
|
test_images/clipspace-mask-4722992.png
DELETED
Binary file (523 kB)
|
|
test_images/clipspace-mask-4736783.png
DELETED
Binary file (672 kB)
|
|
test_images/man.png
DELETED
Binary file (432 kB)
|
|
test_images/woman.png
DELETED
Binary file (559 kB)
|
|
test_images/user3-f.jpg → user3-f.jpg
RENAMED
File without changes
|
test_images/user3.jpg → user3-m.jpg
RENAMED
File without changes
|