mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
@@ -296,7 +296,7 @@ class APIControl:
|
||||
output_info += item
|
||||
else:
|
||||
pass
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
|
||||
# return
|
||||
b64images = list(map(helpers.encode_pil_to_base64, output_images)) if send_images else []
|
||||
|
||||
@@ -120,7 +120,7 @@ class APIGenerate:
|
||||
processed = process_images(p)
|
||||
processed = scripts_manager.scripts_txt2img.after(p, processed, *script_args)
|
||||
p.close()
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
if processed is None or processed.images is None or len(processed.images) == 0:
|
||||
b64images = []
|
||||
else:
|
||||
@@ -173,7 +173,7 @@ class APIGenerate:
|
||||
processed = process_images(p)
|
||||
processed = scripts_manager.scripts_img2img.after(p, processed, *script_args)
|
||||
p.close()
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
if processed is None or processed.images is None or len(processed.images) == 0:
|
||||
b64images = []
|
||||
else:
|
||||
|
||||
@@ -82,7 +82,7 @@ class APIProcess:
|
||||
jobid = shared.state.begin('API-PRE', api=True)
|
||||
processed = processor(image, local_config=req.params)
|
||||
image = encode_pil_to_base64(processed)
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
return ResPreprocess(model=processor.processor_id, image=image)
|
||||
|
||||
def get_mask(self):
|
||||
@@ -110,7 +110,7 @@ class APIProcess:
|
||||
jobid = shared.state.begin('API-MASK', api=True)
|
||||
with self.queue_lock:
|
||||
processed = masking.run_mask(input_image=image, input_mask=mask, return_type=req.type)
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
if processed is None:
|
||||
return JSONResponse(status_code=400, content={"error": "Mask is none"})
|
||||
image = encode_pil_to_base64(processed)
|
||||
@@ -134,7 +134,7 @@ class APIProcess:
|
||||
classes.append(item.cls)
|
||||
labels.append(item.label)
|
||||
boxes.append(item.box)
|
||||
shared.state.end(jobid)
|
||||
shared.state.end(jobid, api=False)
|
||||
return ResFace(classes=classes, labels=labels, scores=scores, boxes=boxes, images=images)
|
||||
|
||||
def post_prompt_enhance(self, req: models.ReqPromptEnhance):
|
||||
|
||||
@@ -217,7 +217,7 @@ class State:
|
||||
self.sampling_steps = 0
|
||||
self.textinfo = None
|
||||
self.prediction_type = "epsilon"
|
||||
self.api = api or self.api
|
||||
self.api = api if api is not None else False
|
||||
self.time_start = time.time()
|
||||
self.history('begin', self.id)
|
||||
if debug_output:
|
||||
@@ -225,7 +225,7 @@ class State:
|
||||
modules.devices.torch_gc()
|
||||
return self.id
|
||||
|
||||
def end(self, task_id=None):
|
||||
def end(self, task_id=None, api=None):
|
||||
import modules.devices
|
||||
if debug_output:
|
||||
log.trace(f'State end: {self}')
|
||||
@@ -236,6 +236,8 @@ class State:
|
||||
self.job = prev_job['job']
|
||||
self.duration = round(time.time() - prev_job['timestamp'], 3) if prev_job['timestamp'] is not None else None
|
||||
self.time_start = time.time()
|
||||
if api is not None:
|
||||
self.api = api
|
||||
self.history('end', task_id or self.id)
|
||||
self.clear()
|
||||
modules.devices.torch_gc()
|
||||
|
||||
@@ -225,11 +225,7 @@ def create_color_inputs(tab):
|
||||
with gr.Row(elem_id=f"{tab}_grading_lut_row"):
|
||||
grading_lut_file = gr.File(label='LUT .cube file', file_types=['.cube'], elem_id=f"{tab}_grading_lut_file")
|
||||
grading_lut_strength = gr.Slider(minimum=0.0, maximum=2.0, step=0.05, value=1.0, label='LUT strength', elem_id=f"{tab}_grading_lut_strength")
|
||||
return hdr_mode, hdr_brightness, hdr_color, hdr_sharpen, hdr_clamp, hdr_boundary, hdr_threshold, hdr_maximize, hdr_max_center, hdr_max_boundary, hdr_color_picker, hdr_tint_ratio, hdr_apply_hires, \
|
||||
grading_brightness, grading_contrast, grading_saturation, grading_hue, grading_gamma, grading_sharpness, grading_color_temp, \
|
||||
grading_shadows, grading_midtones, grading_highlights, grading_clahe_clip, grading_clahe_grid, \
|
||||
grading_shadows_tint, grading_highlights_tint, grading_split_tone_balance, \
|
||||
grading_vignette, grading_grain, grading_lut_file, grading_lut_strength
|
||||
return hdr_mode, hdr_brightness, hdr_color, hdr_sharpen, hdr_clamp, hdr_boundary, hdr_threshold, hdr_maximize, hdr_max_center, hdr_max_boundary, hdr_color_picker, hdr_tint_ratio, hdr_apply_hires, grading_brightness, grading_contrast, grading_saturation, grading_hue, grading_gamma, grading_sharpness, grading_color_temp, grading_shadows, grading_midtones, grading_highlights, grading_clahe_clip, grading_clahe_grid, grading_shadows_tint, grading_highlights_tint, grading_split_tone_balance, grading_vignette, grading_grain, grading_lut_file, grading_lut_strength
|
||||
|
||||
|
||||
def create_sampler_and_steps_selection(choices, tabname, default_steps:int=20):
|
||||
|
||||
Reference in New Issue
Block a user