comdoleger commited on
Commit
0263e4d
1 Parent(s): 0a54537

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -19
app.py CHANGED
@@ -18,6 +18,14 @@ rmbgkey = os.getenv("RMBGKEY")
18
 
19
  #fore, prompt, intensity, mode, refprompt, isrmbg
20
  outputs_list = [["examples/out1.png"],["examples/out3.png"], ["examples/out4.png"],["examples/out5.png"],["examples/out6.png"],["examples/out7.png"],["examples/out2.png"]]
 
 
 
 
 
 
 
 
21
  example_list = [
22
  [
23
  "examples/in1.png",
@@ -28,19 +36,10 @@ example_list = [
28
  False,
29
  "examples/out1.png"
30
  ],
31
- [
32
- "examples/in3.png",
33
- "A PAir of Shoes, resting on a sleek white platform under a bright spotlight, with subtle pastel-colored reflections and delicate flower petals scattered around, creating a cheerful and elegant setting",
34
- 2.0,
35
- "full",
36
- "(( A Pair of Brown Shoes )), vibrant, Shadow",
37
- False,
38
- "examples/out3.png"
39
- ],
40
  [
41
  "examples/in4.png",
42
  "A Bottle, placed on a rustic wooden table, viewed from a slight above angle, overlooking a serene beach, with seashells and driftwood artfully scattered around, bathed in the warm glow of the setting sun",
43
- 2.50,
44
  "full",
45
  "A transparent Bottle with a black cap and a semi transparent liquide, Sunset",
46
  False,
@@ -49,16 +48,16 @@ example_list = [
49
  [
50
  "examples/in5.png",
51
  "A Perfume bottle, perched delicately on a rock by the ocean, with a breathtaking sunset casting a golden glow over the waves",
52
- 4.0,
53
  "full",
54
- "A glass perfume Bottle, with a yellow lequide and a black cap, sunset, transparent",
55
  False,
56
  "examples/out5.png"
57
  ],
58
  [
59
  "examples/in6.png",
60
  "A Sofa, In a snug, inviting room, a large sofa accompanied by plush cushions, a thick rug, book-filled shelves, potted plants, framed art, a coffee table with candles, a floor lamp, and gentle, warm lighting",
61
- 3.0,
62
  "full",
63
  "A light grey Sofa, studio light, shadows",
64
  False,
@@ -69,18 +68,27 @@ example_list = [
69
  "A car, on a high-tech city street at night, surrounded by neon lights and holographic billboards, with sleek skyscrapers and flying cars in the background, a glowing cyber-road beneath",
70
  3.0,
71
  "full",
72
- "A light grey Car, vibrant, reflections",
73
  False,
74
  "examples/out7.png"
75
  ],
76
  [
77
  "examples/in2.png",
78
  "Headphones, hovering gracefully against a swirling pastel galaxy, accented by glimmers of stardust, ethereal light beams, and floating musical notes, under a dreamy aurora borealis, with no visible wires",
79
- 2.50,
80
  "full",
81
  "white headphones, vibrant, colorful, ",
82
  False,
83
  "examples/out2.png"
 
 
 
 
 
 
 
 
 
84
  ]
85
  ]
86
 
@@ -206,7 +214,10 @@ def resize_to_fit(max_size, original_size):
206
 
207
 
208
  def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
209
-
 
 
 
210
  if isrmbg:
211
  try:
212
  rmbgfore = rmbg(fore)
@@ -227,7 +238,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
227
  if size[0]*size[1]>(1500*1500):
228
  gr.Warning("ℹ️ The input image size is too big, I will lower it!")
229
  image_width, image_height = resize_to_fit((1500,1500), (image_width, image_height))
230
- fore.resize((1500,1500))
231
 
232
 
233
 
@@ -238,8 +249,8 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
238
  "prompt" : prompt,
239
  "mode" : mode,
240
  "intensity" : float(intensity),
241
- "width" : 1500,
242
- "height" : 1500,
243
  "refprompt" : refprompt
244
  }
245
  #print(f"DATA: {data}")
 
18
 
19
  #fore, prompt, intensity, mode, refprompt, isrmbg
20
  outputs_list = [["examples/out1.png"],["examples/out3.png"], ["examples/out4.png"],["examples/out5.png"],["examples/out6.png"],["examples/out7.png"],["examples/out2.png"]]
21
+ prompt_list = ["A Perfume Bottle, resting on a wooden table, surrounded by lavender leaves with droplets of morning dew glistening, in a serene garden, under the soft glow of a twilight sky, encircled by delicate purple petals",
22
+ "A PAir of Shoes, resting on a sleek white platform under a bright spotlight, with subtle pastel-colored reflections and delicate flower petals scattered around, creating a cheerful and elegant setting",
23
+ "A Perfume bottle, perched delicately on a rock by the ocean, with a breathtaking sunset casting a golden glow over the waves",
24
+ "A Bottle, placed on a rustic wooden table, viewed from a slight above angle, overlooking a serene beach, with seashells and driftwood artfully scattered around, bathed in the warm glow of the setting sun",
25
+ "A Sofa, In a snug, inviting room, a large sofa accompanied by plush cushions, a thick rug, book-filled shelves, potted plants, framed art, a coffee table with candles, a floor lamp, and gentle, warm lighting",
26
+ "A car, on a high-tech city street at night, surrounded by neon lights and holographic billboards, with sleek skyscrapers and flying cars in the background, a glowing cyber-road beneath",
27
+ "Headphones, hovering gracefully against a swirling pastel galaxy, accented by glimmers of stardust, ethereal light beams, and floating musical notes, under a dreamy aurora borealis, with no visible wires"
28
+ ]
29
  example_list = [
30
  [
31
  "examples/in1.png",
 
36
  False,
37
  "examples/out1.png"
38
  ],
 
 
 
 
 
 
 
 
 
39
  [
40
  "examples/in4.png",
41
  "A Bottle, placed on a rustic wooden table, viewed from a slight above angle, overlooking a serene beach, with seashells and driftwood artfully scattered around, bathed in the warm glow of the setting sun",
42
+ 3.50,
43
  "full",
44
  "A transparent Bottle with a black cap and a semi transparent liquide, Sunset",
45
  False,
 
48
  [
49
  "examples/in5.png",
50
  "A Perfume bottle, perched delicately on a rock by the ocean, with a breathtaking sunset casting a golden glow over the waves",
51
+ 4.5,
52
  "full",
53
+ "(( A transparent perfume Bottle )), with a yellow lequide and a black cap, sunset, transparent",
54
  False,
55
  "examples/out5.png"
56
  ],
57
  [
58
  "examples/in6.png",
59
  "A Sofa, In a snug, inviting room, a large sofa accompanied by plush cushions, a thick rug, book-filled shelves, potted plants, framed art, a coffee table with candles, a floor lamp, and gentle, warm lighting",
60
+ 3.5,
61
  "full",
62
  "A light grey Sofa, studio light, shadows",
63
  False,
 
68
  "A car, on a high-tech city street at night, surrounded by neon lights and holographic billboards, with sleek skyscrapers and flying cars in the background, a glowing cyber-road beneath",
69
  3.0,
70
  "full",
71
+ "(( A light grey Car )), vibrant, reflections",
72
  False,
73
  "examples/out7.png"
74
  ],
75
  [
76
  "examples/in2.png",
77
  "Headphones, hovering gracefully against a swirling pastel galaxy, accented by glimmers of stardust, ethereal light beams, and floating musical notes, under a dreamy aurora borealis, with no visible wires",
78
+ 3.0,
79
  "full",
80
  "white headphones, vibrant, colorful, ",
81
  False,
82
  "examples/out2.png"
83
+ ],
84
+ [
85
+ "examples/in3.png",
86
+ "A PAir of Shoes, resting on a sleek white platform under a bright spotlight, with subtle pastel-colored reflections and delicate flower petals scattered around, creating a cheerful and elegant setting",
87
+ 3.5,
88
+ "full",
89
+ "(( A Pair of Brown Shoes )), vibrant, Shadow",
90
+ False,
91
+ "examples/out3.png"
92
  ]
93
  ]
94
 
 
214
 
215
 
216
  def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
217
+
218
+ max_size = (1500,1500)
219
+ if prompt in prompt_list:
220
+ max_size = (1800,1800)
221
  if isrmbg:
222
  try:
223
  rmbgfore = rmbg(fore)
 
238
  if size[0]*size[1]>(1500*1500):
239
  gr.Warning("ℹ️ The input image size is too big, I will lower it!")
240
  image_width, image_height = resize_to_fit((1500,1500), (image_width, image_height))
241
+ fore.resize(max_size)
242
 
243
 
244
 
 
249
  "prompt" : prompt,
250
  "mode" : mode,
251
  "intensity" : float(intensity),
252
+ "width" : max_size[0],
253
+ "height" : max_size[1],
254
  "refprompt" : refprompt
255
  }
256
  #print(f"DATA: {data}")