nftnik commited on
Commit
512703d
verified
1 Parent(s): df613a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -27
app.py CHANGED
@@ -14,8 +14,10 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
14
  comfyui_path = os.path.join(current_dir, "ComfyUI")
15
  sys.path.append(comfyui_path)
16
 
17
- # Agora podemos importar os m贸dulos do ComfyUI
18
  import folder_paths
 
 
19
 
20
  # Configura莽茫o inicial e diagn贸stico CUDA
21
  print("Python version:", sys.version)
@@ -25,38 +27,16 @@ print("Quantidade de GPUs:", torch.cuda.device_count())
25
  if torch.cuda.is_available():
26
  print("GPU atual:", torch.cuda.get_device_name(0))
27
 
28
- # Adicionar o caminho da pasta ComfyUI ao sys.path
29
- current_dir = os.path.dirname(os.path.abspath(__file__))
30
- comfyui_path = os.path.join(current_dir, "ComfyUI")
31
- sys.path.append(comfyui_path)
32
-
33
- # Inicializar o ComfyUI
34
- def init_comfyui():
35
- import execution
36
- from nodes import NODE_CLASS_MAPPINGS, init_extra_nodes
37
- import server
38
- import asyncio
39
-
40
- # Criar e configurar o loop de eventos
41
- loop = asyncio.new_event_loop()
42
- asyncio.set_event_loop(loop)
43
-
44
- # Inicializar servidor e n贸s
45
- server_instance = server.PromptServer(loop)
46
- execution.PromptQueue(server_instance)
47
- init_extra_nodes()
48
-
49
- return NODE_CLASS_MAPPINGS
50
-
51
- print("Inicializando ComfyUI...")
52
- NODE_CLASS_MAPPINGS = init_comfyui()
53
-
54
  # Configura莽茫o de diret贸rios
55
  BASE_DIR = os.path.dirname(os.path.realpath(__file__))
56
  output_dir = os.path.join(BASE_DIR, "output")
57
  os.makedirs(output_dir, exist_ok=True)
58
  folder_paths.set_output_directory(output_dir)
59
 
 
 
 
 
60
  # Helper function
61
  def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
62
  try:
 
14
  comfyui_path = os.path.join(current_dir, "ComfyUI")
15
  sys.path.append(comfyui_path)
16
 
17
+ # Agora importar os m贸dulos do ComfyUI
18
  import folder_paths
19
+ from nodes import NODE_CLASS_MAPPINGS, init_extra_nodes
20
+ import comfy.utils
21
 
22
  # Configura莽茫o inicial e diagn贸stico CUDA
23
  print("Python version:", sys.version)
 
27
  if torch.cuda.is_available():
28
  print("GPU atual:", torch.cuda.get_device_name(0))
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  # Configura莽茫o de diret贸rios
31
  BASE_DIR = os.path.dirname(os.path.realpath(__file__))
32
  output_dir = os.path.join(BASE_DIR, "output")
33
  os.makedirs(output_dir, exist_ok=True)
34
  folder_paths.set_output_directory(output_dir)
35
 
36
+ # Inicializar n贸s extras
37
+ print("Inicializando ComfyUI...")
38
+ init_extra_nodes()
39
+
40
  # Helper function
41
  def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
42
  try: