Alexander Bagus commited on
Commit
4f97a9e
·
1 Parent(s): 259506a
Files changed (3) hide show
  1. app.py +7 -2
  2. repos/VideoX-Fun +1 -0
  3. utils/repo_utils.py +14 -1
app.py CHANGED
@@ -2,8 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  import random, json, spaces, torch, time
4
  from diffusers import AutoencoderKL, FlowMatchEulerDiscreteScheduler
5
- from videox_fun.pipeline import ZImageControlPipeline
6
- from videox_fun.models import ZImageControlTransformer2DModel
7
  from transformers import AutoTokenizer, Qwen3ForCausalLM
8
  from diffusers import AutoencoderKL
9
  from utils.image_utils import get_image_latent, rescale_image
@@ -12,11 +11,17 @@ from utils import repo_utils
12
  # from controlnet_aux import HEDdetector, MLSDdetector, OpenposeDetector, CannyDetector, MidasDetector
13
  from controlnet_aux.processor import Processor
14
 
 
 
 
 
 
15
 
16
  repo_utils.clone_repo_if_not_exists("https://huggingface.co/Tongyi-MAI/Z-Image-Turbo", "app/models")
17
  repo_utils.clone_repo_if_not_exists("https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union", "app/models")
18
 
19
 
 
20
  # MODEL_REPO = "Tongyi-MAI/Z-Image-Turbo"
21
  MAX_SEED = np.iinfo(np.int32).max
22
  MAX_IMAGE_SIZE = 1280
 
2
  import numpy as np
3
  import random, json, spaces, torch, time
4
  from diffusers import AutoencoderKL, FlowMatchEulerDiscreteScheduler
5
+
 
6
  from transformers import AutoTokenizer, Qwen3ForCausalLM
7
  from diffusers import AutoencoderKL
8
  from utils.image_utils import get_image_latent, rescale_image
 
11
  # from controlnet_aux import HEDdetector, MLSDdetector, OpenposeDetector, CannyDetector, MidasDetector
12
  from controlnet_aux.processor import Processor
13
 
14
+ # clone and move videox_fun
15
+ repo_utils.clone_repo_if_not_exists("https://github.com/aigc-apps/VideoX-Fun.git", "app/repos")
16
+ repo_utils.move_folder("app/repos/VideoX-Fun/videox_fun", "app/videox_fun")
17
+ from videox_fun.pipeline import ZImageControlPipeline
18
+ from videox_fun.models import ZImageControlTransformer2DModel
19
 
20
  repo_utils.clone_repo_if_not_exists("https://huggingface.co/Tongyi-MAI/Z-Image-Turbo", "app/models")
21
  repo_utils.clone_repo_if_not_exists("https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union", "app/models")
22
 
23
 
24
+
25
  # MODEL_REPO = "Tongyi-MAI/Z-Image-Turbo"
26
  MAX_SEED = np.iinfo(np.int32).max
27
  MAX_IMAGE_SIZE = 1280
repos/VideoX-Fun ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 4935a7039153498b1a8bc9bce06ab8bc99d94f6e
utils/repo_utils.py CHANGED
@@ -1,4 +1,4 @@
1
- import os, subprocess
2
 
3
  def clone_repo_if_not_exists(git_url, git_dir):
4
  """
@@ -31,3 +31,16 @@ def clone_repo_if_not_exists(git_url, git_dir):
31
  else:
32
  print(f"Repository '{git_name}' already exists at '{repo_path}'. Skipping clone.")
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, subprocess, shutil
2
 
3
  def clone_repo_if_not_exists(git_url, git_dir):
4
  """
 
31
  else:
32
  print(f"Repository '{git_name}' already exists at '{repo_path}'. Skipping clone.")
33
 
34
+
35
+ def move_folder(source_path, destination_path):
36
+ """
37
+ Moves a folder from source_path to destination_path.
38
+ If a folder already exists at destination_path, it will be replaced.
39
+ """
40
+ home_dir = os.path.expanduser("~")
41
+ source_path = os.path.join(home_dir, source_path)
42
+ destination_path = os.path.join(home_dir, destination_path)
43
+
44
+ if shutil.os.path.exists(destination_path):
45
+ shutil.rmtree(destination_path) # Remove existing destination folder
46
+ shutil.move(source_path, destination_path)