Update app.py
Browse files
app.py
CHANGED
|
@@ -11,21 +11,22 @@ repo = "artificialguybr/TshirtDesignRedmond-V2"
|
|
| 11 |
trigger_word = "T shirt design, TshirtDesignAF, "
|
| 12 |
|
| 13 |
# Function to generate image based on the prompt
|
| 14 |
-
def generate_image(color_prompt, dress_type_prompt, design_prompt, text):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
prompt_parts = [a, color_prompt, dress_type_prompt, design_prompt, part_5]
|
| 23 |
|
| 24 |
# Optional parts
|
| 25 |
if text:
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
prompt_parts.append(
|
| 29 |
|
| 30 |
# Combine all parts into a full prompt
|
| 31 |
prompt = " ".join([part for part in prompt_parts if part])
|
|
@@ -65,19 +66,25 @@ def generate_image(color_prompt, dress_type_prompt, design_prompt, text):
|
|
| 65 |
print("API Error:", response.status_code)
|
| 66 |
raise Exception(f"API Error: {response.status_code}")
|
| 67 |
|
|
|
|
| 68 |
iface = gr.Interface(
|
| 69 |
fn=generate_image,
|
| 70 |
inputs=[
|
|
|
|
| 71 |
gr.Textbox(lines=1, placeholder="Color Prompt"), # color_prompt
|
| 72 |
gr.Textbox(lines=1, placeholder="Dress Type Prompt"), # dress_type_prompt
|
| 73 |
gr.Textbox(lines=2, placeholder="Design Prompt"), # design_prompt
|
| 74 |
-
gr.Textbox(lines=1, placeholder="Text (Optional)"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
],
|
| 76 |
outputs="image",
|
| 77 |
title="Clothe Designs to use in our img2img model",
|
| 78 |
description="Make designs for your clothes",
|
| 79 |
-
examples=[["Red", "T-shirt", "Simple design", "Stylish Text"]]
|
| 80 |
)
|
| 81 |
|
| 82 |
print("Launching Gradio interface...")
|
| 83 |
-
iface.launch()
|
|
|
|
| 11 |
trigger_word = "T shirt design, TshirtDesignAF, "
|
| 12 |
|
| 13 |
# Function to generate image based on the prompt
|
| 14 |
+
def generate_image(a, color_prompt, dress_type_prompt, design_prompt, text, shadows):
|
| 15 |
+
prompt_parts = [
|
| 16 |
+
a,
|
| 17 |
+
color_prompt,
|
| 18 |
+
dress_type_prompt,
|
| 19 |
+
design_prompt,
|
| 20 |
+
"hangs effortlessly on a plain grey wall, its simplicity transformed by bold",
|
| 21 |
+
]
|
|
|
|
| 22 |
|
| 23 |
# Optional parts
|
| 24 |
if text:
|
| 25 |
+
typography = "contemporary typography reading"
|
| 26 |
+
contrast = "The contrast between the text and the calm background creates a striking visual"
|
| 27 |
+
prompt_parts.extend([typography, text, contrast])
|
| 28 |
|
| 29 |
+
prompt_parts.append(shadows)
|
| 30 |
|
| 31 |
# Combine all parts into a full prompt
|
| 32 |
prompt = " ".join([part for part in prompt_parts if part])
|
|
|
|
| 66 |
print("API Error:", response.status_code)
|
| 67 |
raise Exception(f"API Error: {response.status_code}")
|
| 68 |
|
| 69 |
+
# Gradio Interface
|
| 70 |
iface = gr.Interface(
|
| 71 |
fn=generate_image,
|
| 72 |
inputs=[
|
| 73 |
+
gr.Textbox(visible=False, placeholder="Hidden Part 1"), # a (hidden)
|
| 74 |
gr.Textbox(lines=1, placeholder="Color Prompt"), # color_prompt
|
| 75 |
gr.Textbox(lines=1, placeholder="Dress Type Prompt"), # dress_type_prompt
|
| 76 |
gr.Textbox(lines=2, placeholder="Design Prompt"), # design_prompt
|
| 77 |
+
gr.Textbox(lines=1, placeholder="Text (Optional)"), # text
|
| 78 |
+
gr.Textbox(visible=False, placeholder="Hidden Part 5"), # Hangs effortlessly (hidden)
|
| 79 |
+
gr.Textbox(visible=False, placeholder="Hidden Part 6"), # Typography (hidden)
|
| 80 |
+
gr.Textbox(visible=False, placeholder="Hidden Part 8"), # Contrast (hidden)
|
| 81 |
+
gr.Textbox(visible=False, placeholder="Hidden Part 9"), # Shadows (hidden)
|
| 82 |
],
|
| 83 |
outputs="image",
|
| 84 |
title="Clothe Designs to use in our img2img model",
|
| 85 |
description="Make designs for your clothes",
|
| 86 |
+
examples=[["a part", "Red", "T-shirt", "Simple design", "Stylish Text"]]
|
| 87 |
)
|
| 88 |
|
| 89 |
print("Launching Gradio interface...")
|
| 90 |
+
iface.launch()
|