Update app.py
Browse files
app.py
CHANGED
|
@@ -11,16 +11,21 @@ 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(
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Optional parts
|
| 18 |
if text:
|
| 19 |
-
|
| 20 |
-
contrast = "The contrast between the text and the calm background creates a striking visual"
|
| 21 |
-
prompt_parts.extend([typography, text, contrast])
|
| 22 |
|
| 23 |
-
prompt_parts.append(
|
| 24 |
|
| 25 |
# Combine all parts into a full prompt
|
| 26 |
prompt = " ".join([part for part in prompt_parts if part])
|
|
@@ -60,22 +65,19 @@ def generate_image(a, color_prompt, dress_type_prompt, design_prompt, text, shad
|
|
| 60 |
print("API Error:", response.status_code)
|
| 61 |
raise Exception(f"API Error: {response.status_code}")
|
| 62 |
|
| 63 |
-
# Gradio Interface
|
| 64 |
iface = gr.Interface(
|
| 65 |
fn=generate_image,
|
| 66 |
inputs=[
|
| 67 |
-
gr.Textbox(visible=False, placeholder="Hidden Part 1"), # a (hidden)
|
| 68 |
gr.Textbox(lines=1, placeholder="Color Prompt"), # color_prompt
|
| 69 |
gr.Textbox(lines=1, placeholder="Dress Type Prompt"), # dress_type_prompt
|
| 70 |
gr.Textbox(lines=2, placeholder="Design Prompt"), # design_prompt
|
| 71 |
-
gr.Textbox(lines=1, placeholder="Text(
|
| 72 |
-
gr.Textbox(visible=False, placeholder="Hidden Part 9"), # Shadows (hidden)
|
| 73 |
],
|
| 74 |
outputs="image",
|
| 75 |
-
title="
|
| 76 |
description="Make designs for your clothes",
|
| 77 |
-
examples=[["
|
| 78 |
)
|
| 79 |
|
| 80 |
print("Launching Gradio interface...")
|
| 81 |
-
iface.launch()
|
|
|
|
| 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 |
+
# Constructing the prompt with the specified parts
|
| 16 |
+
a = "a"
|
| 17 |
+
part_5 = "hangs effortlessly on a plain grey wall, its simplicity transformed by bold"
|
| 18 |
+
part_6 = "contemporary typography reading"
|
| 19 |
+
part_8 = "The contrast between the text and the calm background creates a striking visual"
|
| 20 |
+
part_9 = "Soft light casts dynamic shadows, adding depth and emphasizing the crisp lines of the design, evoking a sense of modern sophistication."
|
| 21 |
+
|
| 22 |
+
prompt_parts = [a, color_prompt, dress_type_prompt, design_prompt, part_5]
|
| 23 |
|
| 24 |
# Optional parts
|
| 25 |
if text:
|
| 26 |
+
prompt_parts.extend([part_6, text, part_8])
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
prompt_parts.append(part_9)
|
| 29 |
|
| 30 |
# Combine all parts into a full prompt
|
| 31 |
prompt = " ".join([part for part in prompt_parts if part])
|
|
|
|
| 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)", label="Optional Text"), # 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()
|