Spaces:
Build error
Build error
feat: adjust the backgroung; change parameters for inference
Browse files- app.py +2 -2
- stable_diffusion_inference.py +11 -9
app.py
CHANGED
|
@@ -21,14 +21,14 @@ examples = [
|
|
| 21 |
]
|
| 22 |
|
| 23 |
css = """
|
| 24 |
-
body {
|
| 25 |
content: "";
|
| 26 |
position: fixed;
|
| 27 |
top: 0;
|
| 28 |
left: 0;
|
| 29 |
width: 100%;
|
| 30 |
height: 100%;
|
| 31 |
-
background: url(
|
| 32 |
filter: blur(8px);
|
| 33 |
z-index: -1;
|
| 34 |
min-height: 100vh;
|
|
|
|
| 21 |
]
|
| 22 |
|
| 23 |
css = """
|
| 24 |
+
body::before {
|
| 25 |
content: "";
|
| 26 |
position: fixed;
|
| 27 |
top: 0;
|
| 28 |
left: 0;
|
| 29 |
width: 100%;
|
| 30 |
height: 100%;
|
| 31 |
+
background: url("https://fastly.picsum.photos/id/65/1920/1080.jpg?hmac=906OwjpX9_xvs1WWE2FOcXxg_a9e3DufNz8XIomLAS4") no-repeat center center fixed;
|
| 32 |
filter: blur(8px);
|
| 33 |
z-index: -1;
|
| 34 |
min-height: 100vh;
|
stable_diffusion_inference.py
CHANGED
|
@@ -12,9 +12,10 @@ from diffusers import StableDiffusionPipeline
|
|
| 12 |
from accelerate import Accelerator
|
| 13 |
import gradio as gr
|
| 14 |
import spaces
|
| 15 |
-
|
| 16 |
from loguru import logger
|
| 17 |
|
|
|
|
|
|
|
| 18 |
model_path = 'Ngene787/Faice_text2face'
|
| 19 |
|
| 20 |
accelerator = Accelerator(mixed_precision="fp16", gradient_accumulation_steps=1)
|
|
@@ -59,12 +60,13 @@ def inference(prompt,
|
|
| 59 |
generator = torch.Generator().manual_seed(seed)
|
| 60 |
|
| 61 |
logger.info('Generating image ...')
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
| 70 |
return image, seed
|
|
|
|
| 12 |
from accelerate import Accelerator
|
| 13 |
import gradio as gr
|
| 14 |
import spaces
|
|
|
|
| 15 |
from loguru import logger
|
| 16 |
|
| 17 |
+
from utils import timer
|
| 18 |
+
|
| 19 |
model_path = 'Ngene787/Faice_text2face'
|
| 20 |
|
| 21 |
accelerator = Accelerator(mixed_precision="fp16", gradient_accumulation_steps=1)
|
|
|
|
| 60 |
generator = torch.Generator().manual_seed(seed)
|
| 61 |
|
| 62 |
logger.info('Generating image ...')
|
| 63 |
+
with timer("inference"):
|
| 64 |
+
image = pipe(
|
| 65 |
+
prompt=prompt,
|
| 66 |
+
negative_prompt=negative_prompt,
|
| 67 |
+
guidance_scale=guidance_scale,
|
| 68 |
+
eta=0.0,
|
| 69 |
+
num_inference_steps=num_inference_steps,
|
| 70 |
+
generator=generator,
|
| 71 |
+
).images[0]
|
| 72 |
return image, seed
|