bug fix and allow errors
This commit is contained in:
parent
1f08dc155e
commit
f16463e74e
13
main.py
13
main.py
|
|
@ -25,6 +25,7 @@ from utilities.constants import VALUE_APP
|
|||
from utilities.constants import VALUE_JOB_PENDING
|
||||
from utilities.constants import VALUE_JOB_RUNNING
|
||||
from utilities.constants import VALUE_JOB_DONE
|
||||
from utilities.constants import VALUE_JOB_FAILED
|
||||
from utilities.envvar import get_env_var_with_default
|
||||
from utilities.envvar import get_env_var
|
||||
from utilities.times import wait_for_seconds
|
||||
|
|
@ -221,9 +222,15 @@ def backend(event_termination):
|
|||
|
||||
config = Config().set_config(next_job)
|
||||
|
||||
result_dict = text2img.lunch(
|
||||
prompt=prompt, negative_prompt=negative_prompt, config=config
|
||||
)
|
||||
try:
|
||||
result_dict = text2img.lunch(
|
||||
prompt=prompt, negative_prompt=negative_prompt, config=config
|
||||
)
|
||||
except BaseException as e:
|
||||
logger.error("text2img.lunch error: {}".format(e))
|
||||
local_job_stack.pop(0)
|
||||
next_job[KEY_JOB_STATUS] = VALUE_JOB_FAILED
|
||||
local_completed_jobs.append(next_job)
|
||||
|
||||
with memory_lock:
|
||||
local_job_stack.pop(0)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
<div class="form-row col-md-6">
|
||||
<label for="inputSteps">Steps</label>
|
||||
<input type="number" class="form-control" id="inputSteps"
|
||||
aria-describedby="inputStepsHelp" placeholder="default is 20">
|
||||
aria-describedby="inputStepsHelp" placeholder="default is 50">
|
||||
<div id="inputStepsHelp" class="form-text">Each step is about 38s (CPU) or 0.1s
|
||||
(GPU)
|
||||
</div>
|
||||
|
|
@ -145,10 +145,12 @@
|
|||
$('#resultStatus').html(response.jobs[0].status)
|
||||
$('#resultSeed').html(response.jobs[0].seed)
|
||||
if (response.jobs[0].status == "done") {
|
||||
$('#resultStatus').html(response.jobs[0].status);
|
||||
$('#newJobImg').attr('src', response.jobs[0].img);
|
||||
return;
|
||||
}
|
||||
if (response.jobs[0].status == "failed") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setTimeout(function () { waitForImage(apikeyVal, uuidValue); }, 1000); // refresh every second
|
||||
},
|
||||
|
|
@ -189,7 +191,7 @@
|
|||
}
|
||||
var stepsVal = parseInt($('#inputSteps').val());
|
||||
if (isNaN(stepsVal)) {
|
||||
stepsVal = 20;
|
||||
stepsVal = 50;
|
||||
}
|
||||
var widthVal = parseInt($('#inputWidth').val());
|
||||
if (isNaN(widthVal)) {
|
||||
|
|
@ -205,6 +207,16 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (widthVal % 8 != 0) {
|
||||
alert("width must be divisible by 8!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (heightVal % 8 != 0) {
|
||||
alert("height must be divisible by 8!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Send POST request using Ajax
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ KEY_JOB_STATUS = "status"
|
|||
VALUE_JOB_PENDING = "pending"
|
||||
VALUE_JOB_RUNNING = "running"
|
||||
VALUE_JOB_DONE = "done"
|
||||
VALUE_JOB_FAILED = "failed"
|
||||
|
||||
REQUIRED_KEYS = [
|
||||
API_KEY.lower(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue