Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Hillobar authored Dec 25, 2023
1 parent 2d7ff1f commit 8e4ccf5
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 153 deletions.
23 changes: 18 additions & 5 deletions rope/Coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,21 @@ def coordinator():
# action.pop(0)
elif action [0][0] == "parameters":
if action[0][1]['UpscaleState']:
if not vm.resnet_model:
vm.resnet_model = load_resnet_model()
# if not vm.resnet_model:
# vm.resnet_model = load_resnet_model()
index = action[0][1]['UpscaleMode']
if action[0][1]['UpscaleModes'][index] == 'GFPGAN':
if not vm.GFPGAN_model:
vm.GFPGAN_model = load_GFPGAN_model()
elif action[0][1]['UpscaleModes'][index] == 'CF':
if not vm.codeformer_model:
vm.codeformer_model = load_codeformer_model()
elif action[0][1]['UpscaleModes'][index] == 'GPEN256':
if not vm.GPEN_256_model:
vm.GPEN_256_model = load_GPEN_256_model()
elif action[0][1]['UpscaleModes'][index] == 'GPEN512':
if not vm.GPEN_512_model:
vm.GPEN_512_model = load_GPEN_512_model()
if action[0][1]["CLIPState"]:
if not vm.clip_session:
vm.clip_session = load_clip_model()
Expand Down Expand Up @@ -177,7 +183,7 @@ def load_swapper_model():
emap = onnx.numpy_helper.to_array(graph.initializer[-1])

sess_options = onnxruntime.SessionOptions()
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
# sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL



Expand All @@ -193,10 +199,17 @@ def load_clip_model():
clip_session.to(device)
return clip_session

def load_GPEN_512_model():
session = onnxruntime.InferenceSession( "./models/GPEN-BFR-512.onnx", providers=["CUDAExecutionProvider", 'CPUExecutionProvider'])
return session

def load_GPEN_256_model():
session = onnxruntime.InferenceSession( "./models/GPEN-BFR-256.onnx", providers=["CUDAExecutionProvider", 'CPUExecutionProvider'])
return session

def load_GFPGAN_model():
GFPGAN_session = onnxruntime.InferenceSession( "./models/GFPGANv1.4.onnx", providers=["CUDAExecutionProvider", 'CPUExecutionProvider'])
return GFPGAN_session
session = onnxruntime.InferenceSession( "./models/GPEN-BFR-512.onnx", providers=["CUDAExecutionProvider", 'CPUExecutionProvider'])
return session

def load_codeformer_model():
codeformer_session = onnxruntime.InferenceSession( "./models/codeformer_fp16.onnx", providers=["CUDAExecutionProvider", 'CPUExecutionProvider'])
Expand Down
19 changes: 14 additions & 5 deletions rope/Dicts.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PARAM_BUTTONS_PARAMS = {
'UpscaleState': False,
'UpscaleMode': 0,
'UpscaleModes': ['GFPGAN', 'CF'],
'UpscaleAmount': [100, 100],
'UpscaleModes': ['GFPGAN', 'CF', 'GPEN256', 'GPEN512'],
'UpscaleAmount': [100, 100, 100, 100],
'UpscaleMin': 0,
'UpscaleMax': 100,
'UpscaleInc': 5,
Expand All @@ -16,15 +16,15 @@
'DiffAmount': [4],
'DiffMin': 0,
'DiffMax': 100,
'DiffInc': 1,
'DiffInc': 2,
'DiffUnit': '%',
'DiffIcon': './rope/media/diff.png',
'DiffMessage': 'DIFFERENCER - Blends between Target Face and Swapped Face based on pixel difference. [LB: on/off, MW: difference threshold]',

'BorderState': False,
'BorderMode': 0,
'BorderModes': ['Brdr Top', 'Brdr Sides', 'Brdr Bttm', 'Brdr Blur'],
'BorderAmount': [5, 5, 5, 10],
'BorderAmount': [10, 10, 10, 10],
'BorderMin': 0,
'BorderMax': 64,
'BorderInc': 1,
Expand Down Expand Up @@ -153,7 +153,16 @@
'TransformIcon': './rope/media/construction.png',
'TransformMessage': 'SCALE - Adjust the scale of the face. Use with Background parser to blend into the image. [LB: on/off, MW: amount]',


'ColorState': False,
'ColorMode': 0,
'ColorModes': ['Red', 'Green', 'Blue'],
'ColorAmount': [0, 0, 0],
'ColorMin': -100,
'ColorMax': 100,
'ColorInc': 1,
'ColorUnit': 'i',
'ColorIcon': './rope/media/construction.png',
'ColorMessage': 'SCALE - Adjust the scale of the face. Use with Background parser to blend into the image. [LB: on/off, MW: amount]',

"CLIPText": '',

Expand Down
Loading

0 comments on commit 8e4ccf5

Please sign in to comment.