Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,28 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
hf_token = os.environ.get("HF_TOKEN")
|
| 4 |
import torch
|
| 5 |
from diffusers import StableDiffusion3Pipeline
|
| 6 |
from diffusers.models.controlnet_sd3 import ControlNetSD3Model
|
| 7 |
from diffusers.utils.torch_utils import randn_tensor
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# load pipeline
|
| 11 |
base_model = 'stabilityai/stable-diffusion-3-medium-diffusers'
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
+
import sys
|
| 4 |
+
import subprocess
|
| 5 |
+
|
| 6 |
+
# Clone the specific branch
|
| 7 |
+
subprocess.run(["git", "clone", "-b", "sd3_control", "https://github.com/instantX-research/diffusers_sd3_control.git"])
|
| 8 |
+
|
| 9 |
+
# Change directory to the cloned repository and install it
|
| 10 |
+
os.chdir('diffusers_sd3_control')
|
| 11 |
+
subprocess.run(["pip", "install", "-e", "."])
|
| 12 |
+
|
| 13 |
hf_token = os.environ.get("HF_TOKEN")
|
| 14 |
import torch
|
| 15 |
from diffusers import StableDiffusion3Pipeline
|
| 16 |
from diffusers.models.controlnet_sd3 import ControlNetSD3Model
|
| 17 |
from diffusers.utils.torch_utils import randn_tensor
|
| 18 |
+
|
| 19 |
+
# Add the path to the examples directory
|
| 20 |
+
sys.path.append(os.path.abspath('./examples/community'))
|
| 21 |
+
|
| 22 |
+
# Import the required pipeline
|
| 23 |
+
from pipeline_stable_diffusion_3_controlnet import StableDiffusion3CommonPipeline
|
| 24 |
+
|
| 25 |
+
|
| 26 |
|
| 27 |
# load pipeline
|
| 28 |
base_model = 'stabilityai/stable-diffusion-3-medium-diffusers'
|