lixiang46 commited on
Commit
06436de
1 Parent(s): 1ae1c49

add exampes

Browse files
Files changed (10) hide show
  1. .gitattributes +8 -0
  2. app.py +21 -10
  3. image/1.png +3 -0
  4. image/1_masked.png +3 -0
  5. image/2.png +3 -0
  6. image/2_masked.png +3 -0
  7. image/3.png +3 -0
  8. image/3_mask.png +3 -0
  9. image/4.png +3 -0
  10. image/4_mask.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ image/2.png filter=lfs diff=lfs merge=lfs -text
37
+ image/2_masked.png filter=lfs diff=lfs merge=lfs -text
38
+ image/3.png filter=lfs diff=lfs merge=lfs -text
39
+ image/3_mask.png filter=lfs diff=lfs merge=lfs -text
40
+ image/4.png filter=lfs diff=lfs merge=lfs -text
41
+ image/4_mask.png filter=lfs diff=lfs merge=lfs -text
42
+ image/1.png filter=lfs diff=lfs merge=lfs -text
43
+ image/1_masked.png filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -35,12 +35,15 @@ MAX_IMAGE_SIZE = 1024
35
  @spaces.GPU
36
  def infer(prompt,
37
  image,
 
38
  negative_prompt = "",
39
  seed = 0,
40
  randomize_seed = False,
41
  guidance_scale = 5.0,
42
  num_inference_steps = 25
43
  ):
 
 
44
  if randomize_seed:
45
  seed = random.randint(0, MAX_SEED)
46
  generator = torch.Generator().manual_seed(seed)
@@ -62,6 +65,14 @@ def infer(prompt,
62
  return result
63
 
64
  examples = [
 
 
 
 
 
 
 
 
65
  ]
66
 
67
  css="""
@@ -91,12 +102,12 @@ with gr.Blocks(css=css) as Kolors:
91
  lines=2
92
  )
93
  with gr.Row():
94
- image = gr.ImageEditor(type='pil', image_mode='RGB', layers=False, brush=gr.Brush(colors=["#AAAAAA"], color_mode="fixed"))
 
95
  with gr.Accordion("Advanced Settings", open=False):
96
  negative_prompt = gr.Textbox(
97
  label="Negative prompt",
98
  placeholder="Enter a negative prompt",
99
- visible=True,
100
  value='残缺的手指,畸形的手指,畸形的手,残肢,模糊,低质量'
101
  )
102
  seed = gr.Slider(
@@ -128,17 +139,17 @@ with gr.Blocks(css=css) as Kolors:
128
  with gr.Column(elem_id="col-right"):
129
  result = gr.Image(label="Result", show_label=False)
130
 
131
- # with gr.Row():
132
- # gr.Examples(
133
- # fn = infer,
134
- # examples = examples,
135
- # inputs = [prompt, ip_adapter_image, ip_adapter_scale],
136
- # outputs = [result]
137
- # )
138
 
139
  run_button.click(
140
  fn = infer,
141
- inputs = [prompt, image, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
142
  outputs = [result]
143
  )
144
 
 
35
  @spaces.GPU
36
  def infer(prompt,
37
  image,
38
+ mask_image = None,
39
  negative_prompt = "",
40
  seed = 0,
41
  randomize_seed = False,
42
  guidance_scale = 5.0,
43
  num_inference_steps = 25
44
  ):
45
+ if mask_image != None:
46
+ image = dict({'background': image, 'layers': [negative_prompt]})
47
  if randomize_seed:
48
  seed = random.randint(0, MAX_SEED)
49
  generator = torch.Generator().manual_seed(seed)
 
65
  return result
66
 
67
  examples = [
68
+ ["一只带着红色帽子的小猫咪,圆脸,大眼,极度可爱,高饱和度,立体,柔和的光线",
69
+ "image/1.png", "image/1_masked.png"],
70
+ ["This is a mouth-watering hot pot scene, with all kinds of delicious ingredients cooking in the boiling pot, emitting intoxicating heat and aroma. The fiery red peppers and bright chili oil are shining, with attractive and fascinating colors. The delicate thin-cut beef, refreshing tofu skin, enoki mushrooms with rich abalone sauce, and crisp vegetables in the pot are combined together to create a colorful visual presentation",
71
+ "image/2.png", "image/2_masked.png"],
72
+ ["穿着美少女战士的衣服,一件类似于水手服风格的衣服,包括一个白色紧身上衣,前胸搭配一个大大的红色蝴蝶结。衣服的领子部分呈蓝色,并且有白色条纹。她还穿着一条蓝色百褶裙,超高清,辛烷渲染,高级质感,32k,高分辨率,最好的质量,超级细节,景深",
73
+ "image/3.png", "image/3_masked.png"],
74
+ ["Wearing Iron Man's clothes, high-tech armor, the main colors are red and gold, and there are some silverdecorations. There is a light-up round reactor device on the chest, full of futuristic technology. Ultra-clear , high-quality, ultra-realistic, high-resolution, best quality, super details, depth of field",
75
+ "image/4.png", "image/4_masked.png"],
76
  ]
77
 
78
  css="""
 
102
  lines=2
103
  )
104
  with gr.Row():
105
+ image = gr.ImageEditor(label='Image', type='pil', image_mode='RGB', layers=False, brush=gr.Brush(colors=["#AAAAAA"], color_mode="fixed"))
106
+ mask_image = gr.Image(labe='Mask_Image',type='pil', visible=False, value=None)
107
  with gr.Accordion("Advanced Settings", open=False):
108
  negative_prompt = gr.Textbox(
109
  label="Negative prompt",
110
  placeholder="Enter a negative prompt",
 
111
  value='残缺的手指,畸形的手指,畸形的手,残肢,模糊,低质量'
112
  )
113
  seed = gr.Slider(
 
139
  with gr.Column(elem_id="col-right"):
140
  result = gr.Image(label="Result", show_label=False)
141
 
142
+ with gr.Row():
143
+ gr.Examples(
144
+ fn = infer,
145
+ examples = examples,
146
+ inputs = [prompt, image, mask_image],
147
+ outputs = [result]
148
+ )
149
 
150
  run_button.click(
151
  fn = infer,
152
+ inputs = [prompt, image, None, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps],
153
  outputs = [result]
154
  )
155
 
image/1.png ADDED

Git LFS Details

  • SHA256: 2e424492b89946f08a5279a265f8621cf124fea8f65a8fd04c46ff452c5eca9b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.01 MB
image/1_masked.png ADDED

Git LFS Details

  • SHA256: 037dc543414a4f2ecbdcb546f15a73cfafafc0a8782375a017db49038fd5639f
  • Pointer size: 131 Bytes
  • Size of remote file: 795 kB
image/2.png ADDED

Git LFS Details

  • SHA256: 3175b53f931fe1cc8d2f3fee9a9f0d5d120379be6246b3c024a3449fbe6a91fb
  • Pointer size: 131 Bytes
  • Size of remote file: 994 kB
image/2_masked.png ADDED

Git LFS Details

  • SHA256: 896ec49c140fe3553a96fc134eebcfdab4cee1fbdfcc131b605af866e2888e4a
  • Pointer size: 131 Bytes
  • Size of remote file: 688 kB
image/3.png ADDED

Git LFS Details

  • SHA256: 415ec19888709b6fc61adc56f9804b09c5a0251dca5ccddf2286fa307d0c2ed8
  • Pointer size: 132 Bytes
  • Size of remote file: 1.12 MB
image/3_mask.png ADDED

Git LFS Details

  • SHA256: e2d4833d285fb328a547ce9a8fc7781f846b06890f1d38e865293f7373dad603
  • Pointer size: 129 Bytes
  • Size of remote file: 6.18 kB
image/4.png ADDED

Git LFS Details

  • SHA256: 112981fb2f62a6ae05de385dff714c7a6d0dd9a80cfae8a4a936daf568398a97
  • Pointer size: 132 Bytes
  • Size of remote file: 1.1 MB
image/4_mask.png ADDED

Git LFS Details

  • SHA256: de8f28fc0bb557c9d3f0404737ac5f5a49f8651790ad96e04e11cc58f0dc77dc
  • Pointer size: 129 Bytes
  • Size of remote file: 7.71 kB