no, I keep getting error in json http response from backend that: “{ “error”: “not all…
- User
no, I keep getting error in json http response from backend that: “{ “error”: “not all arguments converted during string formatting” }” also, the actual request in json http is not “0.0” in value for width and height for xxx and yyy: inputs “” nerdcodes 5333 parameters {…} guidance_scale 7.473 height “468.800” negative_prompt “” width “628.800” stride “1” I apologize for the misunderstanding. To ensure the values for xxx and yyy in the JSON request body are “0.0” when they need to be lowered, you can modify the code as follows:
const inputTextArea = document.getElementById(‘inputTextArea’).value; const inputTextArea2 = document.getElementById(‘inputTextArea2’).value; const xxxInput = document.getElementById(‘xxx’); const yyyInput = document.getElementById(‘yyy’); const CFGInput = document.getElementById(‘CFG’);
let CFG; if (!isNaN(parseFloat(CFGInput.value))) { CFG = parseFloat(CFGInput.value).toFixed(3); CFG = parseFloat(CFG); }
let xxx, originalXxx; if (!isNaN(parseFloat(xxxInput.value))) { originalXxx = parseFloat(xxxInput.value).toFixed(3); xxx = parseFloat(originalXxx);
// Adjust xxx to the nearest value divisible by 8 within the range of 0.000 if (xxx % 8 !== 0) { xxx = Math.max(0, Math.round(xxx / 8) * 8); } } else { originalXxx = xxxInput.value; xxx = 0.0; }
let yyy, originalYyy; if (!isNaN(parseFloat(yyyInput.value))) { originalYyy = parseFloat(yyyInput.value).toFixed(3); yyy = parseFloat(originalYyy);
// Adjust yyy to the nearest value divisible by 8 within the range of 0.000 if (yyy % 8 !== 0) { yyy = Math.max(0, Math.round(yyy / 8) * 8); } } else { originalYyy = yyyInput.value; yyy = 0.0; }
const requestBody = { stride: ‘1’, nerdcodes: genRanNum(), inputs: inputTextArea, parameters: { guidance_scale: CFG, negative_prompt: inputTextArea2, width: xxx.toFixed(1), height: yyy.toFixed(1) } };
const requestPayload = JSON.stringify(Object.assign({}, requestBody));
In this modified code, I have removed the Math.min() function calls for xxx and yyy to retain the adjusted values even if they are greater than 0.0. However, when assigning them to the width and height fields of the requestBody, I am using the toFixed(1) method to ensure they are rounded and have only one decimal place, resulting in “0.0” as the final string representation.
Please note that the error you mentioned in the JSON response could be related to other issues in your code or backend implementation. It is recommended to review the backend implementation and ensure that all the required arguments are correctly provided. yes, it seems that backend cannot handle resolutions lower than “0.0”. the same error: not all arguments converted during string formatting If the backend cannot handle resolutions lower than “0.0” and you are still getting the error “not all arguments converted during string formatting”, it is likely that there is an issue with the backend implementation or the way the request payload is being processed.
You should check the backend code to ensure that the string formatting is correctly implemented and that all the required arguments are being passed and used correctly. The error message suggests that there might be a mismatch between the expected format in the backend and the actual values being provided.
- Assistant
).toFixed(3); CFG = parseFloat(CFG); }
let xxx, originalXxx; if (!isNaN(parseFloat(xxxInput.value))) { originalXxx = parseFloat(xxxInput.value).toFixed(3); xxx = parseFloat(originalXxx);
// Adjust xxx to the nearest value divisible by 8 within the range of 0.000 if (xxx % 8 !== 0) { xxx = Math.max(0, Math.round(xxx / 8) * 8); } } else { originalXxx = xxxInput.value; xxx = 0.0; }
let yyy, originalYyy; if (!isNaN(parseFloat(yyyInput.value))) { originalYyy = parseFloat(yyyInput.value).toFixed(3); yyy = parseFloat(originalYyy);
// Adjust yyy to the nearest value divisible by 8 within the range of 0.000 if (yyy % 8 !== 0) { yyy = Math.max(0, Math.round(yyy / 8) * 8); }
// Check if yyy is less than a certain threshold and adjust it accordingly if (yyy < 8) { yyy = 8; } } else { originalYyy = yyyInput.value; yyy = 0.0; }
- User
can you explain on which power of 8 to multiply aspect-ratio?
- Assistant
To clarify, when adjusting the width and height values to the nearest value divisible by 8, you don't multiply them by a power of 8. Instead, you divide the values by 8 and then round them to the nearest whole number. Finally, you multiply the rounded value by 8 to obtain the adjusted value.
For example, if you have a width value of 16.3, the calculation would be as follows:
- Divide the width value by 8: 16.3 / 8 = 2.0375
- Round the result to the nearest whole number: 2.0375 rounded to 2
- Multiply the rounded value by 8: 2 * 8 = 16
So, the adjusted width value in this case would be 16.
Similarly, when adjusting the height value, you follow the same process. Divide by 8, round to the nearest whole number, and then multiply by 8.
Please note that this process ensures that the values are rounded to a multiple of 8 to maintain compatibility with certain systems or constraints that require alignment to a certain grid or resolution. The specific use case or requirements may vary, so it's important to adapt the calculation according to the specific needs of your project or system.
- User
need some factor in 8 through 16px as min value for width (xxx) and 16 pix min value for heigh(yyy) and max value for width is 1280px and max value for height is 720px. need to adjust throughout this range in all possible dimensions and aspect-ratios by two input fileds. any ideas?
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.