added ability to select the output image to share

This commit is contained in:
thecooltechguy
2023-10-29 16:27:24 -07:00
parent 8b2048e5c3
commit c25b2bd1e9
3 changed files with 149 additions and 29 deletions

View File

@@ -1272,9 +1272,14 @@ async def share_art(request):
is_nsfw = json_data['is_nsfw']
prompt = json_data['prompt']
potential_outputs = json_data['potential_outputs']
# for now, pick the first output
output_to_share = potential_outputs[0]
selected_output_index = json_data['selected_output_index']
try:
output_to_share = potential_outputs[int(selected_output_index)]
except:
# for now, pick the first output
output_to_share = potential_outputs[0]
assert output_to_share['type'] in ('image',)
output_dir = folder_paths.get_output_directory()