Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
-
import
|
|
|
|
|
|
|
|
|
|
| 2 |
from huggingface_hub import snapshot_download
|
| 3 |
from kolors.pipelines.pipeline_stable_diffusion_xl_chatglm_256 import StableDiffusionXLPipeline
|
| 4 |
from kolors.models.modeling_chatglm import ChatGLMModel
|
|
@@ -29,6 +32,7 @@ pipe = StableDiffusionXLPipeline(
|
|
| 29 |
pipe = pipe.to("cuda")
|
| 30 |
pipe.enable_model_cpu_offload()
|
| 31 |
|
|
|
|
| 32 |
def generate_image(prompt, height, width, num_inference_steps, guidance_scale):
|
| 33 |
seed = random.randint(0, 18446744073709551615)
|
| 34 |
image = pipe(
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
+
import os
|
| 3 |
+
import torch
|
| 4 |
+
import random
|
| 5 |
from huggingface_hub import snapshot_download
|
| 6 |
from kolors.pipelines.pipeline_stable_diffusion_xl_chatglm_256 import StableDiffusionXLPipeline
|
| 7 |
from kolors.models.modeling_chatglm import ChatGLMModel
|
|
|
|
| 32 |
pipe = pipe.to("cuda")
|
| 33 |
pipe.enable_model_cpu_offload()
|
| 34 |
|
| 35 |
+
@spaces.GPU
|
| 36 |
def generate_image(prompt, height, width, num_inference_steps, guidance_scale):
|
| 37 |
seed = random.randint(0, 18446744073709551615)
|
| 38 |
image = pipe(
|