|
import time |
|
import torch |
|
|
|
from cogvideox.api.api import infer_forward_api, update_diffusion_transformer_api, update_edition_api |
|
from cogvideox.ui.ui import ui_modelscope, ui_eas, ui |
|
|
|
if __name__ == "__main__": |
|
|
|
ui_mode = "eas" |
|
|
|
|
|
low_gpu_memory_mode = False |
|
|
|
|
|
weight_dtype = torch.bfloat16 |
|
|
|
|
|
server_name = "0.0.0.0" |
|
server_port = 7860 |
|
|
|
|
|
model_name = "models/Diffusion_Transformer/CogVideoX-Fun-V1.1-5b-InP" |
|
|
|
model_type = "Inpaint" |
|
|
|
savedir_sample = "samples" |
|
|
|
if ui_mode == "modelscope": |
|
demo, controller = ui_modelscope(model_name, model_type, savedir_sample, low_gpu_memory_mode, weight_dtype) |
|
elif ui_mode == "eas": |
|
demo, controller = ui_eas(model_name, savedir_sample) |
|
else: |
|
demo, controller = ui(low_gpu_memory_mode, weight_dtype) |
|
|
|
|
|
app, _, _ = demo.queue(status_update_rate=1).launch( |
|
server_name=server_name, |
|
server_port=server_port, |
|
prevent_thread_lock=True |
|
) |
|
|
|
|
|
infer_forward_api(None, app, controller) |
|
update_diffusion_transformer_api(None, app, controller) |
|
update_edition_api(None, app, controller) |
|
|
|
|
|
while True: |
|
time.sleep(5) |