Spaces:
Paused
Paused
test gradio
Browse files- app.py +3 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
4 |
from huggingface_hub import login
|
5 |
import os
|
6 |
-
|
7 |
# Log in to Hugging Face with your token
|
8 |
token = os.getenv("HF_TOKEN")
|
9 |
login(token=token)
|
@@ -18,9 +18,9 @@ pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
|
18 |
model_id, controlnet=controlnet, torch_dtype=torch.float16
|
19 |
)
|
20 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
21 |
-
pipe = pipe.to("cuda")
|
22 |
|
23 |
-
|
24 |
def generate_image(prompt, reference_image):
|
25 |
# Prepare the reference image for ControlNet
|
26 |
reference_image = reference_image.convert("RGB").resize((512, 512))
|
|
|
3 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
4 |
from huggingface_hub import login
|
5 |
import os
|
6 |
+
import spaces
|
7 |
# Log in to Hugging Face with your token
|
8 |
token = os.getenv("HF_TOKEN")
|
9 |
login(token=token)
|
|
|
18 |
model_id, controlnet=controlnet, torch_dtype=torch.float16
|
19 |
)
|
20 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
21 |
+
pipe = pipe.to("cuda")
|
22 |
|
23 |
+
@spaces.GPU
|
24 |
def generate_image(prompt, reference_image):
|
25 |
# Prepare the reference image for ControlNet
|
26 |
reference_image = reference_image.convert("RGB").resize((512, 512))
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ diffusers
|
|
3 |
transformers
|
4 |
accelerate
|
5 |
gradio
|
6 |
-
sentencepiece
|
|
|
|
3 |
transformers
|
4 |
accelerate
|
5 |
gradio
|
6 |
+
sentencepiece
|
7 |
+
spaces
|