mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-10 18:05:16 +00:00
feat: preview method endpoint
* post method `/preview_method` is added https://github.com/comfyanonymous/ComfyUI/issues/6205
This commit is contained in:
parent
a618f768e0
commit
c3cc84fa18
21
server.py
21
server.py
@ -33,6 +33,7 @@ from app.model_manager import ModelFileManager
|
||||
from app.custom_node_manager import CustomNodeManager
|
||||
from typing import Optional
|
||||
from api_server.routes.internal.internal_routes import InternalRoutes
|
||||
import latent_preview
|
||||
|
||||
class BinaryEventTypes:
|
||||
PREVIEW_IMAGE = 1
|
||||
@ -692,6 +693,26 @@ class PromptServer():
|
||||
|
||||
return web.Response(status=200)
|
||||
|
||||
@routes.post("/preview_method")
|
||||
async def preview_method(request):
|
||||
json_data = await request.json()
|
||||
|
||||
if "value" in json_data:
|
||||
method = json_data['value']
|
||||
|
||||
if method == 'auto':
|
||||
args.preview_method = latent_preview.LatentPreviewMethod.Auto
|
||||
elif method == 'latent2rgb':
|
||||
args.preview_method = latent_preview.LatentPreviewMethod.Latent2RGB
|
||||
elif method == 'taesd':
|
||||
args.preview_method = latent_preview.LatentPreviewMethod.TAESD
|
||||
else:
|
||||
args.preview_method = latent_preview.LatentPreviewMethod.NoPreviews
|
||||
|
||||
return web.Response(status=200)
|
||||
|
||||
return web.Response(status=400)
|
||||
|
||||
async def setup(self):
|
||||
timeout = aiohttp.ClientTimeout(total=None) # no timeout
|
||||
self.client_session = aiohttp.ClientSession(timeout=timeout)
|
||||
|
Loading…
Reference in New Issue
Block a user