This commit is contained in:
beta9 2024-10-20 20:22:06 -04:00
parent 6ef45cb0ce
commit 3cb0220cd9

16
app.py
View File

@ -2,8 +2,10 @@ from beam import task_queue, Output, Image, env, Volume
import os import os
import sys import sys
import requests import requests
if env.is_remote(): if env.is_remote():
import folder_paths import folder_paths
sys.path.append(os.getcwd()) sys.path.append(os.getcwd())
import main import main
@ -19,28 +21,26 @@ def upload_models():
for model_name, filename, directory in model_urls: for model_name, filename, directory in model_urls:
if not os.path.exists(f"{directory}/{filename}"): if not os.path.exists(f"{directory}/{filename}"):
print(os.getcwd()) print(os.getcwd())
os.system(f"wget -c https://huggingface.co/{model_name}/resolve/main/{filename} -P {os.path.join(os.getcwd() , directory)}") os.system(
f"wget -c https://huggingface.co/{model_name}/resolve/main/{filename} -P {os.path.join(os.getcwd() , directory)}"
)
# Import functions or execute code from workflow_api.py # Import functions or execute code from workflow_api.py
# Step 1: Define environment setup and model loading # Step 1: Define environment setup and model loading
@endpoint( @task_queue(
name="ComfyUI", name="ComfyUI",
cpu=4, cpu=4,
memory="32Gi", memory="32Gi",
gpu="A10G", gpu="A10G",
image=Image( image=Image(
python_version="python3.10", python_version="python3.10",
python_packages=requirements.txt, python_packages="requirements.txt",
# commands=["pip3 install opencv-python"], # commands=["pip3 install opencv-python"],
), ),
volumes=[Volume(name="PUTVOLUMEHERE", mount_path="./VOLUMEPATH)], volumes=[Volume(name="PUTVOLUMEHERE", mount_path="./VOLUMEPATH")],
# keep_warm_seconds=0, # keep_warm_seconds=0,
# on_start=upload_models, # on_start=upload_models,
) )
def generate_video(**inputs): def generate_video(**inputs):
while(true):
main() main()