Spaces:
Build error
Build error
feat: add test for inference and remove the picture.
Browse files- app.py +3 -1
- stable_diffusion_inference.py +1 -6
app.py
CHANGED
|
@@ -7,9 +7,11 @@
|
|
| 7 |
"""
|
| 8 |
import gradio as gr
|
| 9 |
|
| 10 |
-
from stable_diffusion_inference import inference, MAX_SEED
|
| 11 |
from utils import timer
|
| 12 |
|
|
|
|
|
|
|
| 13 |
examples = [
|
| 14 |
"Portrait of a young woman with long wavy hair, soft studio lighting, high contrast, 4k resolution, professional headshot",
|
| 15 |
"Close-up of a smiling man with sharp jawline, cinematic lighting, shallow depth of field, bokeh background",
|
|
|
|
| 7 |
"""
|
| 8 |
import gradio as gr
|
| 9 |
|
| 10 |
+
from stable_diffusion_inference import inference, MAX_SEED
|
| 11 |
from utils import timer
|
| 12 |
|
| 13 |
+
MAX_IMAGE_SIZE = 1024
|
| 14 |
+
|
| 15 |
examples = [
|
| 16 |
"Portrait of a young woman with long wavy hair, soft studio lighting, high contrast, 4k resolution, professional headshot",
|
| 17 |
"Close-up of a smiling man with sharp jawline, cinematic lighting, shallow depth of field, bokeh background",
|
stable_diffusion_inference.py
CHANGED
|
@@ -41,7 +41,6 @@ pipe.enable_attention_slicing()
|
|
| 41 |
pipe.enable_vae_slicing()
|
| 42 |
|
| 43 |
MAX_SEED = np.iinfo(np.int32).max
|
| 44 |
-
MAX_IMAGE_SIZE = 1024
|
| 45 |
|
| 46 |
|
| 47 |
@spaces.GPU(duration=65)
|
|
@@ -49,10 +48,8 @@ def inference(prompt,
|
|
| 49 |
negative_prompt="",
|
| 50 |
seed=0,
|
| 51 |
randomize_seed=False,
|
| 52 |
-
width=MAX_IMAGE_SIZE,
|
| 53 |
-
height=MAX_IMAGE_SIZE,
|
| 54 |
guidance_scale=7.5,
|
| 55 |
-
num_inference_steps=
|
| 56 |
progress=gr.Progress(track_tqdm=True), ):
|
| 57 |
if randomize_seed:
|
| 58 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -66,8 +63,6 @@ def inference(prompt,
|
|
| 66 |
guidance_scale=guidance_scale,
|
| 67 |
eta=0.0,
|
| 68 |
num_inference_steps=num_inference_steps,
|
| 69 |
-
# width=width,
|
| 70 |
-
# height=height,
|
| 71 |
generator=generator,
|
| 72 |
).images[0]
|
| 73 |
# image = pipe(prompt).images[0]
|
|
|
|
| 41 |
pipe.enable_vae_slicing()
|
| 42 |
|
| 43 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
@spaces.GPU(duration=65)
|
|
|
|
| 48 |
negative_prompt="",
|
| 49 |
seed=0,
|
| 50 |
randomize_seed=False,
|
|
|
|
|
|
|
| 51 |
guidance_scale=7.5,
|
| 52 |
+
num_inference_steps=50,
|
| 53 |
progress=gr.Progress(track_tqdm=True), ):
|
| 54 |
if randomize_seed:
|
| 55 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 63 |
guidance_scale=guidance_scale,
|
| 64 |
eta=0.0,
|
| 65 |
num_inference_steps=num_inference_steps,
|
|
|
|
|
|
|
| 66 |
generator=generator,
|
| 67 |
).images[0]
|
| 68 |
# image = pipe(prompt).images[0]
|