-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need Java example #31
Comments
I have similar issue, My problem is that I use XHRequest (from QML) and it always append "charset=UTF-8" at end of content type. Strangely, stability api does not accept it. I find it strange that a big api like this gives error when the charset=UTF-8 is appended into application/json... what a strange thing is this. |
don't know what to do to solve this |
this work for me File file = new File("/Users/liinns/Desktop/test中.jpeg");
try {
BufferedImage originalImage = ImageIO.read(file);
int width = originalImage.getWidth();
int height = originalImage.getHeight();
int newWidth = width + (64 - (width % 64));
int newHeight = height + (64 - (height % 64));
BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, originalImage.getType());
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g.dispose();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(resizedImage, "jpeg", byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
param.setInit_image(byteArray);
} catch (IOException e) {
e.printStackTrace();
} |
Did you fix this error? tell me please |
I try to invoke the stabilty rest api in Java via apache httpclient. Following is my code:
`@Override
public byte[] generate(String input, Config config) throws Exception {
String apiUrl = String.format("%s/v1/generation/%s/image-to-image",
Constants.STABILITY_API_HOST, "stable-diffusion-512-v2-1");
CloseableHttpClient httpClient = HttpClientUtils.getHttpClient();
}`
I think every thing is OK, but it returns me an error:
{"id":"b5ad9f42296d3eea01cd2bd3307478fb","message":"can't decode multipart body","name":"bad_request"}
What's going wrong?
The text was updated successfully, but these errors were encountered: