ideprado commited on
Commit
c5a017f
·
1 Parent(s): e52e8c8

Increase duration

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,9 +8,8 @@ from pikigen import PikigenPipeline
8
 
9
  # Trick required because it is not a native diffusers model
10
  from diffusers.pipelines.pipeline_loading_utils import LOADABLE_CLASSES, ALL_IMPORTABLE_CLASSES
11
- LOADABLE_CLASSES.setdefault("pikigen", {}).setdefault("DiT", []).extend(["save_pretrained", "from_pretrained"])
12
- LOADABLE_CLASSES["pikigen.model"] = LOADABLE_CLASSES["pikigen"]
13
- ALL_IMPORTABLE_CLASSES.setdefault("DiT", []).extend(["save_pretrained", "from_pretrained"])
14
 
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
  model_repo_id = "Freepik/Pikigen-test"
@@ -22,6 +21,7 @@ else:
22
 
23
  pipe = PikigenPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
24
  # pipe.enable_model_cpu_offload() # For less memory consumption
 
25
  pipe.vae.enable_slicing()
26
  pipe.vae.enable_tiling()
27
 
@@ -29,7 +29,7 @@ MAX_SEED = np.iinfo(np.int32).max
29
  MAX_IMAGE_SIZE = 1024
30
 
31
 
32
- @spaces.GPU
33
  def infer(
34
  prompt,
35
  negative_prompt,
 
8
 
9
  # Trick required because it is not a native diffusers model
10
  from diffusers.pipelines.pipeline_loading_utils import LOADABLE_CLASSES, ALL_IMPORTABLE_CLASSES
11
+ LOADABLE_CLASSES["pikigen"] = LOADABLE_CLASSES["pikigen.model"] = {"DiT": ["save_pretrained", "from_pretrained"]}
12
+ ALL_IMPORTABLE_CLASSES["DiT"] = ["save_pretrained", "from_pretrained"]
 
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  model_repo_id = "Freepik/Pikigen-test"
 
21
 
22
  pipe = PikigenPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
23
  # pipe.enable_model_cpu_offload() # For less memory consumption
24
+ pipe.to(device)
25
  pipe.vae.enable_slicing()
26
  pipe.vae.enable_tiling()
27
 
 
29
  MAX_IMAGE_SIZE = 1024
30
 
31
 
32
+ @spaces.GPU(duration=500)
33
  def infer(
34
  prompt,
35
  negative_prompt,