multimodalart HF Staff commited on
Commit
4cf0d64
·
verified ·
1 Parent(s): 09e9314

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -11,16 +11,16 @@ pipe_14b = Cosmos2TextToImagePipeline.from_pretrained(model_14b_id,
11
  revision="refs/pr/1",
12
  torch_dtype=torch.bfloat16
13
  )
14
- #pipe_2b = Cosmos2TextToImagePipeline.from_pretrained(model_2b_id,
15
- # revision="refs/pr/2",
16
- # text_encoder=pipe_14b.text_encoder,
17
- # safety_checker=pipe_14b.safety_checker,
18
- # vae=pipe_14b.vae,
19
- # tokenizer=pipe_14b.tokenizer,
20
- # torch_dtype=torch.bfloat16
21
- # )
22
  pipe_14b.to("cuda")
23
- #pipe_2b.to("cuda")
24
 
25
  scheduler = EDMEulerScheduler(
26
  sigma_min=0.002,
@@ -37,13 +37,21 @@ scheduler = EDMEulerScheduler(
37
  pipe_14b.scheduler = scheduler
38
  #pipe_2b.scheduler = scheduler
39
 
40
- @spaces.GPU
41
- def generate_image(prompt, negative_prompt="The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality.", seed=42, randomize_seed=False, model_choice="14B", progress=gr.Progress(track_tqdm=True)):
 
 
 
 
 
 
42
 
43
  if model_choice == "14B":
44
  pipe = pipe_14b
45
- #else:
46
- # pipe = pipe_2b
 
 
47
 
48
  if randomize_seed:
49
  actual_seed = random.randint(0, 1000000)
 
11
  revision="refs/pr/1",
12
  torch_dtype=torch.bfloat16
13
  )
14
+ pipe_2b = Cosmos2TextToImagePipeline.from_pretrained(model_2b_id,
15
+ revision="refs/pr/2",
16
+ text_encoder=pipe_14b.text_encoder,
17
+ safety_checker=pipe_14b.safety_checker,
18
+ vae=pipe_14b.vae,
19
+ tokenizer=pipe_14b.tokenizer,
20
+ torch_dtype=torch.bfloat16
21
+ )
22
  pipe_14b.to("cuda")
23
+ pipe_2b.to("cuda")
24
 
25
  scheduler = EDMEulerScheduler(
26
  sigma_min=0.002,
 
37
  pipe_14b.scheduler = scheduler
38
  #pipe_2b.scheduler = scheduler
39
 
40
+ @spaces.GPU(duration=75)
41
+ def generate_image(prompt,
42
+ negative_prompt="The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality.",
43
+ seed=42,
44
+ randomize_seed=False,
45
+ model_choice="14B",
46
+ progress=gr.Progress(track_tqdm=True)
47
+ ):
48
 
49
  if model_choice == "14B":
50
  pipe = pipe_14b
51
+ pipe_2b.to("cpu")
52
+ else:
53
+ pipe = pipe_2b
54
+ pipe_14b.to("cpu")
55
 
56
  if randomize_seed:
57
  actual_seed = random.randint(0, 1000000)