Rishi Desai commited on
Commit
9b027fd
·
1 Parent(s): 8eb9ce4

read me + examples demo

Browse files
FaceEnhancementProdApi.json DELETED
@@ -1,403 +0,0 @@
1
- {
2
- "1": {
3
- "inputs": {
4
- "noise": [
5
- "39",
6
- 0
7
- ],
8
- "guider": [
9
- "122",
10
- 0
11
- ],
12
- "sampler": [
13
- "50",
14
- 0
15
- ],
16
- "sigmas": [
17
- "131",
18
- 0
19
- ],
20
- "latent_image": [
21
- "35",
22
- 0
23
- ]
24
- },
25
- "class_type": "SamplerCustomAdvanced",
26
- "_meta": {
27
- "title": "SamplerCustomAdvanced"
28
- }
29
- },
30
- "23": {
31
- "inputs": {
32
- "text": "",
33
- "clip": [
34
- "94",
35
- 0
36
- ]
37
- },
38
- "class_type": "CLIPTextEncode",
39
- "_meta": {
40
- "title": "CLIP Text Encode (Prompt)"
41
- }
42
- },
43
- "24": {
44
- "inputs": {
45
- "image": "woman_face.jpg"
46
- },
47
- "class_type": "LoadImage",
48
- "_meta": {
49
- "title": "Load Image"
50
- }
51
- },
52
- "35": {
53
- "inputs": {
54
- "pixels": [
55
- "40",
56
- 0
57
- ],
58
- "vae": [
59
- "95",
60
- 0
61
- ]
62
- },
63
- "class_type": "VAEEncode",
64
- "_meta": {
65
- "title": "VAE Encode"
66
- }
67
- },
68
- "37": {
69
- "inputs": {
70
- "strength": 1,
71
- "start_percent": 0.1,
72
- "end_percent": 0.8,
73
- "positive": [
74
- "42",
75
- 0
76
- ],
77
- "negative": [
78
- "23",
79
- 0
80
- ],
81
- "control_net": [
82
- "41",
83
- 0
84
- ],
85
- "image": [
86
- "40",
87
- 0
88
- ],
89
- "vae": [
90
- "95",
91
- 0
92
- ]
93
- },
94
- "class_type": "ControlNetApplyAdvanced",
95
- "_meta": {
96
- "title": "Apply ControlNet"
97
- }
98
- },
99
- "39": {
100
- "inputs": {
101
- "noise_seed": 1
102
- },
103
- "class_type": "RandomNoise",
104
- "_meta": {
105
- "title": "RandomNoise"
106
- }
107
- },
108
- "40": {
109
- "inputs": {
110
- "image": "woman1_gpt_2.png"
111
- },
112
- "class_type": "LoadImage",
113
- "_meta": {
114
- "title": "Load Image"
115
- }
116
- },
117
- "41": {
118
- "inputs": {
119
- "type": "tile",
120
- "control_net": [
121
- "49",
122
- 0
123
- ]
124
- },
125
- "class_type": "SetUnionControlNetType",
126
- "_meta": {
127
- "title": "SetUnionControlNetType"
128
- }
129
- },
130
- "42": {
131
- "inputs": {
132
- "text": "",
133
- "clip": [
134
- "94",
135
- 0
136
- ]
137
- },
138
- "class_type": "CLIPTextEncode",
139
- "_meta": {
140
- "title": "CLIP Text Encode (Prompt)"
141
- }
142
- },
143
- "44": {
144
- "inputs": {
145
- "pulid_file": "pulid_flux_v0.9.1.safetensors"
146
- },
147
- "class_type": "PulidFluxModelLoader",
148
- "_meta": {
149
- "title": "Load PuLID Flux Model"
150
- }
151
- },
152
- "45": {
153
- "inputs": {},
154
- "class_type": "PulidFluxEvaClipLoader",
155
- "_meta": {
156
- "title": "Load Eva Clip (PuLID Flux)"
157
- }
158
- },
159
- "46": {
160
- "inputs": {
161
- "provider": "CUDA"
162
- },
163
- "class_type": "PulidFluxInsightFaceLoader",
164
- "_meta": {
165
- "title": "Load InsightFace (PuLID Flux)"
166
- }
167
- },
168
- "49": {
169
- "inputs": {
170
- "control_net_name": "Flux_Dev_ControlNet_Union_Pro_ShakkerLabs.safetensors"
171
- },
172
- "class_type": "ControlNetLoader",
173
- "_meta": {
174
- "title": "Load ControlNet Model"
175
- }
176
- },
177
- "50": {
178
- "inputs": {
179
- "sampler_name": "euler"
180
- },
181
- "class_type": "KSamplerSelect",
182
- "_meta": {
183
- "title": "KSamplerSelect"
184
- }
185
- },
186
- "93": {
187
- "inputs": {
188
- "unet_name": "flux1-dev.safetensors",
189
- "weight_dtype": "default"
190
- },
191
- "class_type": "UNETLoader",
192
- "_meta": {
193
- "title": "Load Diffusion Model"
194
- }
195
- },
196
- "94": {
197
- "inputs": {
198
- "clip_name1": "t5xxl_fp16.safetensors",
199
- "clip_name2": "clip_l.safetensors",
200
- "type": "flux",
201
- "device": "default"
202
- },
203
- "class_type": "DualCLIPLoader",
204
- "_meta": {
205
- "title": "DualCLIPLoader"
206
- }
207
- },
208
- "95": {
209
- "inputs": {
210
- "vae_name": "ae.safetensors"
211
- },
212
- "class_type": "VAELoader",
213
- "_meta": {
214
- "title": "Load VAE"
215
- }
216
- },
217
- "114": {
218
- "inputs": {
219
- "samples": [
220
- "1",
221
- 0
222
- ],
223
- "vae": [
224
- "95",
225
- 0
226
- ]
227
- },
228
- "class_type": "VAEDecode",
229
- "_meta": {
230
- "title": "VAE Decode"
231
- }
232
- },
233
- "117": {
234
- "inputs": {
235
- "similarity_metric": "cosine",
236
- "filter_thresh": 100,
237
- "filter_best": 0,
238
- "generate_image_overlay": true,
239
- "analysis_models": [
240
- "118",
241
- 0
242
- ],
243
- "reference": [
244
- "24",
245
- 0
246
- ],
247
- "image": [
248
- "114",
249
- 0
250
- ]
251
- },
252
- "class_type": "FaceEmbedDistance",
253
- "_meta": {
254
- "title": "Face Embeds Distance"
255
- }
256
- },
257
- "118": {
258
- "inputs": {
259
- "library": "insightface",
260
- "provider": "CUDA"
261
- },
262
- "class_type": "FaceAnalysisModels",
263
- "_meta": {
264
- "title": "Face Analysis Models"
265
- }
266
- },
267
- "121": {
268
- "inputs": {
269
- "output": "",
270
- "source": [
271
- "117",
272
- 1
273
- ]
274
- },
275
- "class_type": "Display Any (rgthree)",
276
- "_meta": {
277
- "title": "Display Any (rgthree)"
278
- }
279
- },
280
- "122": {
281
- "inputs": {
282
- "model": [
283
- "133",
284
- 0
285
- ],
286
- "conditioning": [
287
- "37",
288
- 0
289
- ]
290
- },
291
- "class_type": "BasicGuider",
292
- "_meta": {
293
- "title": "BasicGuider"
294
- }
295
- },
296
- "123": {
297
- "inputs": {
298
- "rgthree_comparer": {
299
- "images": [
300
- {
301
- "name": "A",
302
- "selected": true,
303
- "url": "/api/view?filename=rgthree.compare._temp_bikvi_00001_.png&type=temp&subfolder=&rand=0.3573763312590408"
304
- },
305
- {
306
- "name": "B",
307
- "selected": true,
308
- "url": "/api/view?filename=rgthree.compare._temp_bikvi_00002_.png&type=temp&subfolder=&rand=0.1379430430729296"
309
- }
310
- ]
311
- },
312
- "image_a": [
313
- "40",
314
- 0
315
- ],
316
- "image_b": [
317
- "114",
318
- 0
319
- ]
320
- },
321
- "class_type": "Image Comparer (rgthree)",
322
- "_meta": {
323
- "title": "Image Comparer (rgthree)"
324
- }
325
- },
326
- "128": {
327
- "inputs": {
328
- "filename_prefix": "FaceEnhanced",
329
- "images": [
330
- "114",
331
- 0
332
- ]
333
- },
334
- "class_type": "SaveImage",
335
- "_meta": {
336
- "title": "Save Image"
337
- }
338
- },
339
- "129": {
340
- "inputs": {
341
- "filename_prefix": "FaceEmbedDist",
342
- "images": [
343
- "117",
344
- 0
345
- ]
346
- },
347
- "class_type": "SaveImage",
348
- "_meta": {
349
- "title": "Save Image"
350
- }
351
- },
352
- "131": {
353
- "inputs": {
354
- "scheduler": "beta",
355
- "steps": 28,
356
- "denoise": 0.75,
357
- "model": [
358
- "133",
359
- 0
360
- ]
361
- },
362
- "class_type": "BasicScheduler",
363
- "_meta": {
364
- "title": "BasicScheduler"
365
- }
366
- },
367
- "133": {
368
- "inputs": {
369
- "weight": 0.7500000000000001,
370
- "start_at": 0.10000000000000002,
371
- "end_at": 1,
372
- "fusion": "mean",
373
- "fusion_weight_max": 1,
374
- "fusion_weight_min": 0,
375
- "train_step": 1000,
376
- "use_gray": true,
377
- "model": [
378
- "93",
379
- 0
380
- ],
381
- "pulid_flux": [
382
- "44",
383
- 0
384
- ],
385
- "eva_clip": [
386
- "45",
387
- 0
388
- ],
389
- "face_analysis": [
390
- "46",
391
- 0
392
- ],
393
- "image": [
394
- "24",
395
- 0
396
- ]
397
- },
398
- "class_type": "ApplyPulidFlux",
399
- "_meta": {
400
- "title": "Apply PuLID Flux"
401
- }
402
- }
403
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gradio_demo.py → demo.py RENAMED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import os
3
  import tempfile
4
- from main import process_face
5
  from PIL import Image
6
 
7
  def enhance_face_gradio(input_image, ref_image):
@@ -30,13 +30,14 @@ def enhance_face_gradio(input_image, ref_image):
30
 
31
  try:
32
  # Process the face
33
- process_face(
34
- input_path=input_path,
35
- ref_path=ref_path,
36
- crop=False,
37
- upscale=False,
38
- output_path=output_path
39
- )
 
40
  except Exception as e:
41
  # Handle the error, log it, and return an error message
42
  print(f"Error processing face: {e}")
@@ -52,12 +53,23 @@ def enhance_face_gradio(input_image, ref_image):
52
  def create_gradio_interface():
53
  # Create the Gradio interface
54
  with gr.Blocks(title="Face Enhancement Demo") as demo:
55
- gr.Markdown("# Face Enhancement Demo")
56
- gr.Markdown("Upload an input image and a reference face image to enhance the input.")
57
-
 
 
 
 
 
 
 
 
 
 
 
58
  with gr.Row():
59
  with gr.Column():
60
- input_image = gr.Image(label="Input Image", type="pil")
61
  ref_image = gr.Image(label="Reference Face", type="pil")
62
  enhance_button = gr.Button("Enhance Face")
63
 
@@ -70,14 +82,13 @@ def create_gradio_interface():
70
  outputs=output_image,
71
  queue=True # Enable queue for sequential processing
72
  )
73
-
74
- gr.Markdown("""
75
- ## Instructions
76
- 1. Upload an image you want to enhance
77
- 2. Upload a reference face image
78
- 3. Click 'Enhance Face' to start the process
79
- 4. Processing takes about 60 seconds
80
- """)
81
 
82
  # Launch the Gradio app with queue
83
  demo.queue(max_size=20) # Configure queue size
 
1
  import gradio as gr
2
  import os
3
  import tempfile
4
+ # from main import process_face
5
  from PIL import Image
6
 
7
  def enhance_face_gradio(input_image, ref_image):
 
30
 
31
  try:
32
  # Process the face
33
+ # process_face(
34
+ # input_path=input_path,
35
+ # ref_path=ref_path,
36
+ # crop=False,
37
+ # upscale=False,
38
+ # output_path=output_path
39
+ # )
40
+ pass
41
  except Exception as e:
42
  # Handle the error, log it, and return an error message
43
  print(f"Error processing face: {e}")
 
53
  def create_gradio_interface():
54
  # Create the Gradio interface
55
  with gr.Blocks(title="Face Enhancement Demo") as demo:
56
+ # Add instructions at the top
57
+ gr.Markdown("""
58
+ # Face Enhancement Demo
59
+ ### Instructions
60
+ 1. Upload an image you want to enhance
61
+ 2. Upload a reference face image
62
+ 3. Click 'Enhance Face' to start the process
63
+ 4. Processing takes about 60 seconds
64
+ """, elem_id="instructions")
65
+
66
+ # Add a horizontal line for separation
67
+ gr.Markdown("---")
68
+
69
+ # Main interface layout
70
  with gr.Row():
71
  with gr.Column():
72
+ input_image = gr.Image(label="Target Image", type="pil")
73
  ref_image = gr.Image(label="Reference Face", type="pil")
74
  enhance_button = gr.Button("Enhance Face")
75
 
 
82
  outputs=output_image,
83
  queue=True # Enable queue for sequential processing
84
  )
85
+
86
+ # Add examples at the bottom in a table format
87
+ with gr.Row():
88
+ gr.Markdown("### Examples")
89
+ with gr.Column():
90
+ gr.Image("examples/chatgpt_dany_1.png", label="Target Image Example")
91
+ gr.Image("examples/dany_face.jpg", label="Reference Face Example")
 
92
 
93
  # Launch the Gradio app with queue
94
  demo.queue(max_size=20) # Configure queue size
examples/chatgpt_dany_1.png ADDED

Git LFS Details

  • SHA256: c51191701586f6fe27abfa08954c6ae84d4edc5974a22f7b9e87c4e4d7e64ab7
  • Pointer size: 132 Bytes
  • Size of remote file: 1.76 MB
examples/dany_face.jpg ADDED

Git LFS Details

  • SHA256: 8002d224b456f028d3106fc3a529eb9e1f2ee8baba8d419962a039d979f12cb8
  • Pointer size: 131 Bytes
  • Size of remote file: 146 kB
examples/enhanced_dany_1.png ADDED

Git LFS Details

  • SHA256: b856d4b7cb9fc1a8ae4ea08cbac707462d0150391084597c4f6372da7021aa33
  • Pointer size: 132 Bytes
  • Size of remote file: 1.64 MB