Update app.py
Browse files
app.py
CHANGED
|
@@ -29,16 +29,16 @@ def chat_fn(message, history):
|
|
| 29 |
return tokenizer.decode(output[0], skip_special_tokens=True)
|
| 30 |
|
| 31 |
# ---------------- IMAGE ----------------
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
def generate_image(prompt):
|
| 36 |
-
image = img_pipe(
|
| 37 |
-
prompt,
|
| 38 |
-
num_inference_steps=4,
|
| 39 |
-
guidance_scale=0.0
|
| 40 |
-
).images[0]
|
| 41 |
-
return image
|
| 42 |
|
| 43 |
# ---------------- UI ----------------
|
| 44 |
with gr.Blocks(
|
|
|
|
| 29 |
return tokenizer.decode(output[0], skip_special_tokens=True)
|
| 30 |
|
| 31 |
# ---------------- IMAGE ----------------
|
| 32 |
+
# ---------- IMAGE MODEL ----------
|
| 33 |
+
from diffusers import StableDiffusionPipeline
|
| 34 |
+
|
| 35 |
+
img_pipe = StableDiffusionPipeline.from_pretrained(
|
| 36 |
+
"stabilityai/sdxl-turbo",
|
| 37 |
+
torch_dtype=torch.float32
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
img_pipe = img_pipe.to("cpu")
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# ---------------- UI ----------------
|
| 44 |
with gr.Blocks(
|