mirror of
				https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
				synced 2025-11-04 12:03:36 +00:00 
			
		
		
		
	load GFPGAN once and keep it in memory for #53
This commit is contained in:
		
							parent
							
								
									e5fc7bb59c
								
							
						
					
					
						commit
						d7b67d9b40
					
				
							
								
								
									
										10
									
								
								webui.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								webui.py
									
									
									
									
									
								
							@ -179,8 +179,16 @@ def gfpgan_model_path():
 | 
			
		||||
    return found[0]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
loaded_gfpgan_model = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def gfpgan():
 | 
			
		||||
    return GFPGANer(model_path=gfpgan_model_path(), upscale=1, arch='clean', channel_multiplier=2, bg_upsampler=None)
 | 
			
		||||
    global loaded_gfpgan_model
 | 
			
		||||
 | 
			
		||||
    if loaded_gfpgan_model is None:
 | 
			
		||||
        loaded_gfpgan_model = GFPGANer(model_path=gfpgan_model_path(), upscale=1, arch='clean', channel_multiplier=2, bg_upsampler=None)
 | 
			
		||||
 | 
			
		||||
    return loaded_gfpgan_model
 | 
			
		||||
 | 
			
		||||
def gfpgan_fix_faces(gfpgan_model, np_image):
 | 
			
		||||
    np_image_bgr = np_image[:, :, ::-1]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user