gaur3009 commited on
Commit
69d2a66
·
verified ·
1 Parent(s): 76f07ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -14
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
- # 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,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)", 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()
 
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()