Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,15 @@ 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(a, color_prompt, dress_type_prompt, design_prompt,
|
| 15 |
prompt_parts = [a, color_prompt, dress_type_prompt, design_prompt]
|
| 16 |
-
|
| 17 |
# Optional parts
|
| 18 |
if text:
|
|
|
|
|
|
|
| 19 |
prompt_parts.extend([typography, text, contrast])
|
| 20 |
-
|
| 21 |
prompt_parts.append(shadows)
|
| 22 |
|
| 23 |
# Combine all parts into a full prompt
|
|
@@ -47,7 +49,7 @@ def generate_image(a, color_prompt, dress_type_prompt, design_prompt, typography
|
|
| 47 |
print("API response status code:", response.status_code)
|
| 48 |
if response.status_code == 200:
|
| 49 |
print("Image generation successful!")
|
| 50 |
-
return Image.open(BytesIO(response.content))
|
| 51 |
elif response.status_code == 503:
|
| 52 |
time.sleep(1)
|
| 53 |
pbar.update(1)
|
|
@@ -66,15 +68,13 @@ iface = gr.Interface(
|
|
| 66 |
gr.Textbox(lines=1, placeholder="Color Prompt"), # color_prompt
|
| 67 |
gr.Textbox(lines=1, placeholder="Dress Type Prompt"), # dress_type_prompt
|
| 68 |
gr.Textbox(lines=2, placeholder="Design Prompt"), # design_prompt
|
| 69 |
-
gr.Textbox(
|
| 70 |
-
gr.Textbox(lines=1, optional=True, placeholder="Text"), # text
|
| 71 |
-
gr.Textbox(visible=False, placeholder="Hidden Part 6"), # Contrast (hidden)
|
| 72 |
gr.Textbox(visible=False, placeholder="Hidden Part 9"), # Shadows (hidden)
|
| 73 |
],
|
| 74 |
outputs="image",
|
| 75 |
title="Clothe Designs to use in our img2img model",
|
| 76 |
description="Make designs for your clothes",
|
| 77 |
-
examples=[["a part", "Red", "T-shirt", "Simple design", "
|
| 78 |
)
|
| 79 |
|
| 80 |
print("Launching Gradio interface...")
|
|
|
|
| 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 = [a, color_prompt, dress_type_prompt, design_prompt]
|
| 16 |
+
|
| 17 |
# Optional parts
|
| 18 |
if text:
|
| 19 |
+
typography = "contemporary typography reading"
|
| 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(shadows)
|
| 24 |
|
| 25 |
# Combine all parts into a full prompt
|
|
|
|
| 49 |
print("API response status code:", response.status_code)
|
| 50 |
if response.status_code == 200:
|
| 51 |
print("Image generation successful!")
|
| 52 |
+
return Image.open(BytesIO(response.content))
|
| 53 |
elif response.status_code == 503:
|
| 54 |
time.sleep(1)
|
| 55 |
pbar.update(1)
|
|
|
|
| 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"), # text
|
|
|
|
|
|
|
| 72 |
gr.Textbox(visible=False, placeholder="Hidden Part 9"), # Shadows (hidden)
|
| 73 |
],
|
| 74 |
outputs="image",
|
| 75 |
title="Clothe Designs to use in our img2img model",
|
| 76 |
description="Make designs for your clothes",
|
| 77 |
+
examples=[["a part", "Red", "T-shirt", "Simple design", "Stylish Text", "Soft Shadows"]]
|
| 78 |
)
|
| 79 |
|
| 80 |
print("Launching Gradio interface...")
|