AI-RABBIT commited on
Commit
f004e33
·
verified ·
1 Parent(s): 94cbe9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -3,6 +3,14 @@ import torch
3
  from huggingface_hub import hf_hub_download
4
  from diffusers import DiffusionPipeline
5
  from cog_sdxl.dataset_and_utils import TokenEmbeddingsHandler
 
 
 
 
 
 
 
 
6
 
7
  # Load the model pipeline
8
  pipe = DiffusionPipeline.from_pretrained(
@@ -11,6 +19,7 @@ pipe = DiffusionPipeline.from_pretrained(
11
  variant="fp16",
12
  ).to("cuda")
13
 
 
14
  pipe.load_lora_weights("fofr/sdxl-emoji", weight_name="lora.safetensors")
15
 
16
  # Load token embeddings
 
3
  from huggingface_hub import hf_hub_download
4
  from diffusers import DiffusionPipeline
5
  from cog_sdxl.dataset_and_utils import TokenEmbeddingsHandler
6
+ import os
7
+ import git
8
+
9
+ # Clone the cog-sdxl repository if it doesn't exist
10
+ repo_url = "https://github.com/replicate/cog-sdxl.git"
11
+ repo_dir = "./cog-sdxl"
12
+ if not os.path.exists(repo_dir):
13
+ git.Repo.clone_from(repo_url, repo_dir)
14
 
15
  # Load the model pipeline
16
  pipe = DiffusionPipeline.from_pretrained(
 
19
  variant="fp16",
20
  ).to("cuda")
21
 
22
+ # Load the LoRA weights
23
  pipe.load_lora_weights("fofr/sdxl-emoji", weight_name="lora.safetensors")
24
 
25
  # Load token embeddings