yaron123 commited on
Commit
13aff24
·
1 Parent(s): f1deaa5
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -25,7 +25,7 @@ from lxml.html import fromstring
25
  from diffusers.utils import export_to_video, load_image
26
  from huggingface_hub import hf_hub_download
27
  from safetensors.torch import load_file, save_file
28
- from diffusers import FluxPipeline, CogVideoXImageToVideoPipeline
29
  from PIL import Image, ImageDraw, ImageFont
30
 
31
  # logging
@@ -43,10 +43,8 @@ root.addHandler(handler)
43
 
44
  if torch.cuda.is_available():
45
  device = "cuda"
46
- dtype = torch.bfloat16
47
  else:
48
  device = "cpu"
49
- dtype = torch.bfloat16
50
 
51
  base = "black-forest-labs/FLUX.1-schnell"
52
 
@@ -57,13 +55,13 @@ additional_image = None
57
  # precision data
58
 
59
  seq=512
60
- fps=12
61
  width=768
62
- height=768
63
  image_steps=8
64
  video_steps=50
65
  img_accu=9
66
- vid_accu=6
67
 
68
  # ui data
69
 
@@ -126,10 +124,13 @@ function custom(){
126
 
127
  # torch pipes
128
 
129
- image_pipe = FluxPipeline.from_pretrained(base, torch_dtype=dtype).to(device)
130
- video_pipe = CogVideoXImageToVideoPipeline.from_pretrained(
131
- "THUDM/CogVideoX-5b-I2V",
132
- torch_dtype=dtype
 
 
 
133
  ).to(device)
134
 
135
  video_pipe.vae.enable_tiling()
@@ -246,12 +247,12 @@ def handle_generate(*_inp):
246
  if len(inp[2]) >= 2:
247
  inp[2] = "," + inp[2].strip(",").strip(" ")
248
 
249
- inp[2] = f"textual content,unrealistic content,divined creatures,unrealistic creatures,creatures out of this world,demon,angel,cgi quality,anime quality,cartoon quality,drawing quality,cropped photo,cropped content,worst quality,low quality,duplicating elements,weird,non-standard human body,non-standard object structure,blur,wrong body anatomy,too big, too small,text,written content{inp[2]}"
250
 
251
  if len(inp[1]) >= 2:
252
  inp[1] = "," + inp[1].strip(",").strip(" ")
253
 
254
- inp[1] = f'looks real,feels real,similar to real photographs,dark natural colors,looks beautiful and pretty,look genuine and authentic,reasonable logic,natural,masterpiece,highly detailed{inp[1]}'
255
 
256
  print(f"""
257
 
 
25
  from diffusers.utils import export_to_video, load_image
26
  from huggingface_hub import hf_hub_download
27
  from safetensors.torch import load_file, save_file
28
+ from diffusers import FluxPipeline, HunyuanVideoPipeline, HunyuanVideoTransformer3DModel
29
  from PIL import Image, ImageDraw, ImageFont
30
 
31
  # logging
 
43
 
44
  if torch.cuda.is_available():
45
  device = "cuda"
 
46
  else:
47
  device = "cpu"
 
48
 
49
  base = "black-forest-labs/FLUX.1-schnell"
50
 
 
55
  # precision data
56
 
57
  seq=512
58
+ fps=15
59
  width=768
60
+ height=512
61
  image_steps=8
62
  video_steps=50
63
  img_accu=9
64
+ vid_accu=7
65
 
66
  # ui data
67
 
 
124
 
125
  # torch pipes
126
 
127
+ image_pipe = FluxPipeline.from_pretrained(base, torch_dtype=torch.float32).to(device)
128
+
129
+ transformer = HunyuanVideoTransformer3DModel.from_pretrained(
130
+ "hunyuanvideo-community/HunyuanVideo", subfolder="transformer", torch_dtype=torch.bfloat16
131
+ )
132
+ video_pipe = HunyuanVideoPipeline.from_pretrained(
133
+ "hunyuanvideo-community/HunyuanVideo", transformer=transformer, torch_dtype=torch.bfloat16
134
  ).to(device)
135
 
136
  video_pipe.vae.enable_tiling()
 
247
  if len(inp[2]) >= 2:
248
  inp[2] = "," + inp[2].strip(",").strip(" ")
249
 
250
+ inp[2] = f"textual,labeled,divined,distorted,discontinuous,ugly,blurry,low resolution,motionless,static,wrong body anatomy{inp[2]}"
251
 
252
  if len(inp[1]) >= 2:
253
  inp[1] = "," + inp[1].strip(",").strip(" ")
254
 
255
+ inp[1] = f'realistic,natural,genuine,reasonable,highly detailed{inp[1]}'
256
 
257
  print(f"""
258