Fixes Use All Parameters

This commit is contained in:
psychedelicious 2022-11-19 17:21:59 +11:00 committed by blessedcoolant
parent b8cebf29f2
commit cdc5f66592
2 changed files with 35 additions and 26 deletions

View File

@ -215,7 +215,7 @@ class InvokeAIWebServer:
sys.exit(0) sys.exit(0)
else: else:
useSSL = (args.certfile or args.keyfile) useSSL = args.certfile or args.keyfile
print(">> Started Invoke AI Web Server!") print(">> Started Invoke AI Web Server!")
if self.host == "0.0.0.0": if self.host == "0.0.0.0":
print( print(
@ -225,12 +225,19 @@ class InvokeAIWebServer:
print( print(
">> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address." ">> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address."
) )
print(f">> Point your browser at http{'s' if useSSL else ''}://{self.host}:{self.port}") print(
f">> Point your browser at http{'s' if useSSL else ''}://{self.host}:{self.port}"
)
if not useSSL: if not useSSL:
self.socketio.run(app=self.app, host=self.host, port=self.port) self.socketio.run(app=self.app, host=self.host, port=self.port)
else: else:
self.socketio.run(app=self.app, host=self.host, port=self.port, self.socketio.run(
certfile=args.certfile, keyfile=args.keyfile) app=self.app,
host=self.host,
port=self.port,
certfile=args.certfile,
keyfile=args.keyfile,
)
def setup_app(self): def setup_app(self):
self.result_url = "outputs/" self.result_url = "outputs/"
@ -909,8 +916,11 @@ class InvokeAIWebServer:
eventlet.sleep(0) eventlet.sleep(0)
# restore the stashed URLS and discard the paths, we are about to send the result to client # restore the stashed URLS and discard the paths, we are about to send the result to client
if "init_img" in all_parameters: all_parameters["init_img"] = (
all_parameters["init_img"] = "" init_img_url
if generation_parameters["generation_mode"] == "img2img"
else ""
)
if "init_mask" in all_parameters: if "init_mask" in all_parameters:
all_parameters["init_mask"] = "" # TODO: store the mask in metadata all_parameters["init_mask"] = "" # TODO: store the mask in metadata
@ -967,7 +977,7 @@ class InvokeAIWebServer:
eventlet.sleep(0) eventlet.sleep(0)
progress.set_current_iteration(progress.current_iteration + 1) progress.set_current_iteration(progress.current_iteration + 1)
print(generation_parameters) print(generation_parameters)
self.generate.prompt2image( self.generate.prompt2image(
@ -1023,6 +1033,8 @@ class InvokeAIWebServer:
postprocessing = [] postprocessing = []
rfc_dict["type"] = parameters["generation_mode"]
# 'postprocessing' is either null or an # 'postprocessing' is either null or an
if "facetool_strength" in parameters: if "facetool_strength" in parameters:
facetool_parameters = { facetool_parameters = {
@ -1071,25 +1083,17 @@ class InvokeAIWebServer:
rfc_dict["variations"] = variations rfc_dict["variations"] = variations
# if "init_img" in parameters: print(parameters)
# rfc_dict["type"] = "img2img"
# rfc_dict["strength"] = parameters["strength"] if rfc_dict["type"] == "img2img":
# rfc_dict["fit"] = parameters["fit"] # TODO: Noncompliant rfc_dict["strength"] = parameters["strength"]
# rfc_dict["orig_hash"] = calculate_init_img_hash( rfc_dict["fit"] = parameters["fit"] # TODO: Noncompliant
# self.get_image_path_from_url(parameters["init_img"]) rfc_dict["orig_hash"] = calculate_init_img_hash(
# ) self.get_image_path_from_url(parameters["init_img"])
# rfc_dict["init_image_path"] = parameters[ )
# "init_img" rfc_dict["init_image_path"] = parameters[
# ] # TODO: Noncompliant "init_img"
# # if 'init_mask' in parameters: ] # TODO: Noncompliant
# # rfc_dict['mask_hash'] = calculate_init_img_hash(
# # self.get_image_path_from_url(parameters['init_mask'])
# # ) # TODO: Noncompliant
# # rfc_dict['mask_image_path'] = parameters[
# # 'init_mask'
# # ] # TODO: Noncompliant
# else:
# rfc_dict["type"] = "txt2img"
metadata["image"] = rfc_dict metadata["image"] = rfc_dict

View File

@ -160,6 +160,11 @@ const CurrentImageButtons = () => {
const handleClickUseAllParameters = () => { const handleClickUseAllParameters = () => {
if (!currentImage) return; if (!currentImage) return;
currentImage.metadata && dispatch(setAllParameters(currentImage.metadata)); currentImage.metadata && dispatch(setAllParameters(currentImage.metadata));
if (currentImage.metadata?.image.type === 'img2img') {
dispatch(setActiveTab('img2img'));
} else if (currentImage.metadata?.image.type === 'txt2img') {
dispatch(setActiveTab('txt2img'));
}
}; };
useHotkeys( useHotkeys(