Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ import gradio as gr
|
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
import spaces
|
| 10 |
from typing import Union, Sequence, Mapping, Any
|
|
|
|
| 11 |
|
| 12 |
# Diagn贸stico CUDA
|
| 13 |
print("Python version:", sys.version)
|
|
@@ -23,10 +24,11 @@ comfyui_path = os.path.join(current_dir, "ComfyUI")
|
|
| 23 |
sys.path.append(comfyui_path)
|
| 24 |
|
| 25 |
# Importar ComfyUI components
|
| 26 |
-
import
|
| 27 |
-
from nodes import NODE_CLASS_MAPPINGS
|
| 28 |
import folder_paths
|
| 29 |
from comfy import model_management
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Configura莽茫o de diret贸rios
|
| 32 |
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
@@ -34,8 +36,12 @@ output_dir = os.path.join(BASE_DIR, "output")
|
|
| 34 |
os.makedirs(output_dir, exist_ok=True)
|
| 35 |
folder_paths.set_output_directory(output_dir)
|
| 36 |
|
| 37 |
-
# Inicializar
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
# Helper function
|
| 41 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|
|
|
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
import spaces
|
| 10 |
from typing import Union, Sequence, Mapping, Any
|
| 11 |
+
import asyncio
|
| 12 |
|
| 13 |
# Diagn贸stico CUDA
|
| 14 |
print("Python version:", sys.version)
|
|
|
|
| 24 |
sys.path.append(comfyui_path)
|
| 25 |
|
| 26 |
# Importar ComfyUI components
|
| 27 |
+
from nodes import NODE_CLASS_MAPPINGS, init_custom_nodes
|
|
|
|
| 28 |
import folder_paths
|
| 29 |
from comfy import model_management
|
| 30 |
+
import execution
|
| 31 |
+
import server
|
| 32 |
|
| 33 |
# Configura莽茫o de diret贸rios
|
| 34 |
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
| 36 |
os.makedirs(output_dir, exist_ok=True)
|
| 37 |
folder_paths.set_output_directory(output_dir)
|
| 38 |
|
| 39 |
+
# Inicializar o servidor e os n贸s
|
| 40 |
+
loop = asyncio.new_event_loop()
|
| 41 |
+
asyncio.set_event_loop(loop)
|
| 42 |
+
server_instance = server.PromptServer(loop)
|
| 43 |
+
execution.PromptQueue(server_instance)
|
| 44 |
+
init_custom_nodes()
|
| 45 |
|
| 46 |
# Helper function
|
| 47 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|