Closed InvictusGar closed 2 months ago
Can you provide your request params
Can you provide your request params
just like this:
def upscale_vary(image, params: dict, host: str) -> dict:
"""
Upscale or Vary
"""
params["input_image"] = base64.b64encode(image).decode('utf-8')
time.sleep(30)
response = requests.post(url=f"{host}/v2/generation/image-upscale-vary",
data=json.dumps(params),
headers={"Content-Type": "application/json"},
timeout=300)
def main(host: str, folder_path: str):
files = glob.glob(os.path.join(folder_path, "*"))
for i,filename in enumerate(files, start=1):
file_path = os.path.join(folder_path, filename)
print(f"Processing file {i}/{len(files)}: {file_path}")
# print(f"proceccing {file_path}")
image = open(file_path, "rb").read()
result = upscale_vary(image=image,
params={
"uov_method": "Upscale (2x)",
"async_process": True
},
host=host)
Thanks for the feedback. Sorry for waiting, but I didn't reproduce the problem. From the log you provided, it seems that the generation failed so that the returned data structure could not be validated correctly. But your log looks incomplete. If you encounter it again, can you provide a complete log and request complete request parameters?
I pushed a patch in dev branch, you can have a try.
I pushed a patch in dev branch, you can have a try.
OK,i'll try and reply later
I pushed a patch in dev branch, you can have a try.
OK,i'll try and reply later
It does't work, No need to try anymore.
return wrong format when queue is full, already fixed
[INFO] Mixing image prompt and vary upscale is set to True INFO: 11.214.132.42:48722 - "POST /v2/generation/image-upscale-vary HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/env-3.10/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi result = await app( # type: ignore[func-returns-value] File "/env-3.10/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/fastapi/applications.py", line 292, in call await super().call(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/env-3.10/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/env-3.10/lib/python3.10/site-packages/starlette/middleware/cors.py", line 83, in call await self.app(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/env-3.10/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/env-3.10/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call raise e File "/env-3.10/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call await self.app(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/env-3.10/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/env-3.10/lib/python3.10/site-packages/fastapi/routing.py", line 273, in app raw_response = await run_endpoint_function( File "/env-3.10/lib/python3.10/site-packages/fastapi/routing.py", line 192, in run_endpoint_function return await run_in_threadpool(dependant.call, *values) File "/env-3.10/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) File "/env-3.10/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/env-3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/env-3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/Fooocus-API/fooocusapi/api.py", line 193, in img_upscale_or_vary_v2 return call_worker(req, accept) File "/Fooocus-API/fooocusapi/api.py", line 90, in call_worker return AsyncJobResponse(job_id='', File "/env-3.10/lib/python3.10/site-packages/pydantic/main.py", line 164, in init pydantic_self.pydantic_validator.validate_python(data, self_instance=__pydantic_self__) pydantic_core._pydantic_core.ValidationError: 1 validation error for AsyncJobResponse job_result.0 Input should be a valid dictionary or instance of GeneratedImageResult [type=model_type, input_value=<fooocusapi.parameters.Im...bject at 0x7fd6d5c5a650>, input_type=ImageGenerationResult] For further information visit https://errors.pydantic.dev/2.4/v/model_type
when I use image-upscale-vary API, some times error occurs, and the output image can not generate successfully, get lost