Spaces:
Runtime error
Runtime error
"updated app.py"
Browse files- app.py +1 -1
- live_preview_helper.py +26 -0
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from datasets import load_dataset
|
|
| 3 |
import gradio as gr, json, os, random, torch
|
| 4 |
from diffusers import StableDiffusionPipeline
|
| 5 |
from gradio_client import Client
|
| 6 |
-
from live_preview_helpers import
|
| 7 |
|
| 8 |
def infer_sd_live(character):
|
| 9 |
prompt = character.get("appearance", "portrait, character, digital art")
|
|
|
|
| 3 |
import gradio as gr, json, os, random, torch
|
| 4 |
from diffusers import StableDiffusionPipeline
|
| 5 |
from gradio_client import Client
|
| 6 |
+
from live_preview_helpers import flux_pipe_call_that_returns_an_iterable_of_image
|
| 7 |
|
| 8 |
def infer_sd_live(character):
|
| 9 |
prompt = character.get("appearance", "portrait, character, digital art")
|
live_preview_helper.py
CHANGED
|
@@ -36,3 +36,29 @@ def sd_live_preview(pipe, prompt, num_inference_steps=30, width=512, height=512,
|
|
| 36 |
)
|
| 37 |
image = result.images[0]
|
| 38 |
yield image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
)
|
| 37 |
image = result.images[0]
|
| 38 |
yield image
|
| 39 |
+
# live_preview_helpers.py
|
| 40 |
+
|
| 41 |
+
def flux_pipe_call_that_returns_an_iterable_of_images(
|
| 42 |
+
self,
|
| 43 |
+
prompt,
|
| 44 |
+
guidance_scale=7.5,
|
| 45 |
+
num_inference_steps=20,
|
| 46 |
+
width=512,
|
| 47 |
+
height=512,
|
| 48 |
+
generator=None,
|
| 49 |
+
output_type="pil",
|
| 50 |
+
good_vae=None
|
| 51 |
+
):
|
| 52 |
+
"""
|
| 53 |
+
Yields a single Stable Diffusion image matching the prompt.
|
| 54 |
+
"""
|
| 55 |
+
image = self(
|
| 56 |
+
prompt=prompt,
|
| 57 |
+
guidance_scale=guidance_scale,
|
| 58 |
+
num_inference_steps=num_inference_steps,
|
| 59 |
+
width=width,
|
| 60 |
+
height=height,
|
| 61 |
+
generator=generator,
|
| 62 |
+
output_type=output_type,
|
| 63 |
+
).images[0]
|
| 64 |
+
yield image
|