Update app.py
Browse files
app.py
CHANGED
@@ -36,8 +36,10 @@ processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-larg
|
|
36 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
37 |
processor1 = BlipProcessor.from_pretrained("noamrot/FuseCap")
|
38 |
model2 = BlipForConditionalGeneration.from_pretrained("noamrot/FuseCap")
|
39 |
-
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium")
|
|
|
40 |
|
|
|
41 |
|
42 |
|
43 |
|
@@ -82,17 +84,26 @@ def generate_caption_and_image(image, f, p, d):
|
|
82 |
|
83 |
prompt = f"Design a high-quality, stylish clothing item that seamlessly blends the essence of {caption1} and {caption2}. The design should prominently feature {f}{d} and incorporate {p}. The final piece should exude sophistication and creativity, suitable for modern trends while retaining an element of timeless appeal. Ensure the textures and patterns complement each other harmoniously, creating a visually striking yet wearable garment."
|
84 |
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
-
# Generate image based on the caption
|
92 |
-
generated_image = pipe(prompt).images[0]
|
93 |
-
generated_image1 =pipe(prompt).images[0]
|
94 |
|
95 |
-
return generated_image, generated_image1
|
96 |
return None, None
|
97 |
# Gradio UI
|
98 |
iface = gr.Interface(
|
|
|
36 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
37 |
processor1 = BlipProcessor.from_pretrained("noamrot/FuseCap")
|
38 |
model2 = BlipForConditionalGeneration.from_pretrained("noamrot/FuseCap")
|
39 |
+
# pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium")
|
40 |
+
from diffusers import FluxPipeline
|
41 |
|
42 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
43 |
|
44 |
|
45 |
|
|
|
84 |
|
85 |
prompt = f"Design a high-quality, stylish clothing item that seamlessly blends the essence of {caption1} and {caption2}. The design should prominently feature {f}{d} and incorporate {p}. The final piece should exude sophistication and creativity, suitable for modern trends while retaining an element of timeless appeal. Ensure the textures and patterns complement each other harmoniously, creating a visually striking yet wearable garment."
|
86 |
|
87 |
+
image = pipe(
|
88 |
+
prompt,
|
89 |
+
height=500,
|
90 |
+
width=500,
|
91 |
+
guidance_scale=3.5,
|
92 |
+
num_inference_steps=50,
|
93 |
+
max_sequence_length=512,
|
94 |
+
generator=torch.Generator("cpu").manual_seed(0)
|
95 |
+
).images[0]
|
96 |
+
return image
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
+
# # Generate image based on the caption
|
103 |
+
# generated_image = pipe(prompt).images[0]
|
104 |
+
# generated_image1 =pipe(prompt).images[0]
|
105 |
|
106 |
+
# return generated_image, generated_image1
|
107 |
return None, None
|
108 |
# Gradio UI
|
109 |
iface = gr.Interface(
|