mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-14 15:32:35 +08:00
Rewrite runpod_handler.py with clean formatting - no whitespace issues
This commit is contained in:
parent
dc5a696d3b
commit
236a174b18
@ -22,6 +22,7 @@ logging.basicConfig(
|
|||||||
)
|
)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ComfyUIServerlessHandler:
|
class ComfyUIServerlessHandler:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.comfyui_url = "http://127.0.0.1:8000"
|
self.comfyui_url = "http://127.0.0.1:8000"
|
||||||
@ -202,6 +203,7 @@ class ComfyUIServerlessHandler:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Cleanup failed: {str(e)}")
|
logger.error(f"Cleanup failed: {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
def handler(job: Dict[str, Any]) -> Dict[str, Any]:
|
def handler(job: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
"""Main serverless handler function"""
|
"""Main serverless handler function"""
|
||||||
handler_instance = ComfyUIServerlessHandler()
|
handler_instance = ComfyUIServerlessHandler()
|
||||||
@ -260,6 +262,7 @@ def handler(job: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
# Always cleanup
|
# Always cleanup
|
||||||
handler_instance.cleanup()
|
handler_instance.cleanup()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Start the serverless worker
|
# Start the serverless worker
|
||||||
runpod.serverless.start({"handler": handler})
|
runpod.serverless.start({"handler": handler})
|
||||||
Loading…
Reference in New Issue
Block a user