Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,23 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
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 |
-
import
|
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(
|
17 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
|
|
1 |
+
import os
|
2 |
+
import git
|
3 |
import gradio as gr
|
4 |
import torch
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
from diffusers import DiffusionPipeline
|
7 |
from cog_sdxl.dataset_and_utils import TokenEmbeddingsHandler
|
8 |
+
import subprocess
|
|
|
9 |
|
10 |
# Clone the cog-sdxl repository if it doesn't exist
|
11 |
repo_url = "https://github.com/replicate/cog-sdxl.git"
|
12 |
repo_dir = "./cog-sdxl"
|
13 |
if not os.path.exists(repo_dir):
|
14 |
+
print("Cloning cog-sdxl repository...")
|
15 |
git.Repo.clone_from(repo_url, repo_dir)
|
16 |
|
17 |
+
# Install cog-sdxl as a local package
|
18 |
+
print("Installing cog-sdxl package...")
|
19 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-e", repo_dir])
|
20 |
+
|
21 |
# Load the model pipeline
|
22 |
pipe = DiffusionPipeline.from_pretrained(
|
23 |
"stabilityai/stable-diffusion-xl-base-1.0",
|