Update app.py
Browse files
app.py
CHANGED
@@ -80,25 +80,25 @@ def generate_caption_and_image(image, f, p, d):
|
|
80 |
out = model.generate(**inputs)
|
81 |
caption1 = processor.decode(out[0], skip_special_tokens=True)
|
82 |
|
83 |
-
prompt = f"
|
84 |
-
|
85 |
-
|
86 |
-
prompt +="The image should have a clean, minimalistic grey or white background, with realistic lighting and fine details, ensuring a sophisticated and polished appearance"
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
# Generate image based on the caption
|
92 |
generated_image = pipe(prompt).images[0]
|
|
|
93 |
|
94 |
-
return generated_image
|
95 |
|
96 |
# Gradio UI
|
97 |
iface = gr.Interface(
|
98 |
fn=generate_caption_and_image,
|
99 |
inputs=[gr.Image(type="pil", label="Upload Image"), gr.Radio(fabrics, label="Select Fabric"), gr.Radio(patterns, label="Select Pattern"), gr.Radio(textile_designs, label="Select Textile Design")],
|
100 |
|
101 |
-
outputs=[gr.Image(label="Generated Design")],
|
102 |
live=True
|
103 |
)
|
104 |
iface.launch(share=True)
|
|
|
80 |
out = model.generate(**inputs)
|
81 |
caption1 = processor.decode(out[0], skip_special_tokens=True)
|
82 |
|
83 |
+
prompt = (f"Create a visually stunning clothing item inspired by: 1. Primary Context: {caption1}, describing the mood and thematic elements of the image. 2. Secondary Insights: {caption2}, providing complementary attributes and textures. 3. Fabric: '{f}', highlighting its qualities. 4. Pattern: '{p}', enhancing visual harmony. 5. Design Style: '{d}', for a refined finish. Use a clean grey/white background with realistic lighting and intricate details for a polished presentation.")
|
84 |
+
|
85 |
+
|
|
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
# Generate image based on the caption
|
91 |
generated_image = pipe(prompt).images[0]
|
92 |
+
generated_image1 =pipe(prompt).images[0]
|
93 |
|
94 |
+
return generated_image, generated_image1
|
95 |
|
96 |
# Gradio UI
|
97 |
iface = gr.Interface(
|
98 |
fn=generate_caption_and_image,
|
99 |
inputs=[gr.Image(type="pil", label="Upload Image"), gr.Radio(fabrics, label="Select Fabric"), gr.Radio(patterns, label="Select Pattern"), gr.Radio(textile_designs, label="Select Textile Design")],
|
100 |
|
101 |
+
outputs=[gr.Image(label="Generated Design 1"), gr.Image(label="Generated Design 2")],
|
102 |
live=True
|
103 |
)
|
104 |
iface.launch(share=True)
|