Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import random
|
| 4 |
-
from diffusers import
|
| 5 |
import torch
|
| 6 |
# from huggingface_hub import notebook_login
|
| 7 |
|
|
@@ -14,11 +14,11 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 14 |
|
| 15 |
if torch.cuda.is_available():
|
| 16 |
torch.cuda.max_memory_allocated(device=device)
|
| 17 |
-
pipe =
|
| 18 |
pipe.enable_xformers_memory_efficient_attention()
|
| 19 |
pipe = pipe.to(device)
|
| 20 |
else:
|
| 21 |
-
pipe =
|
| 22 |
pipe = pipe.to(device)
|
| 23 |
|
| 24 |
MAX_SEED = np.iinfo(np.int32).max
|
|
@@ -33,7 +33,7 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
| 33 |
|
| 34 |
image = pipe(
|
| 35 |
prompt = prompt,
|
| 36 |
-
negative_prompt =
|
| 37 |
guidance_scale = guidance_scale,
|
| 38 |
num_inference_steps = num_inference_steps,
|
| 39 |
width = width,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import random
|
| 4 |
+
from diffusers import AutoPipelineForText2Image
|
| 5 |
import torch
|
| 6 |
# from huggingface_hub import notebook_login
|
| 7 |
|
|
|
|
| 14 |
|
| 15 |
if torch.cuda.is_available():
|
| 16 |
torch.cuda.max_memory_allocated(device=device)
|
| 17 |
+
pipe = AutoPipelineForText2Image.from_pretrained("Shaleen123/kandinsky_2.5", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 18 |
pipe.enable_xformers_memory_efficient_attention()
|
| 19 |
pipe = pipe.to(device)
|
| 20 |
else:
|
| 21 |
+
pipe = AutoPipelineForText2Image.from_pretrained("Shaleen123/kandinsky_2.5", use_safetensors=True, torch_dtype = torch.float16)
|
| 22 |
pipe = pipe.to(device)
|
| 23 |
|
| 24 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 33 |
|
| 34 |
image = pipe(
|
| 35 |
prompt = prompt,
|
| 36 |
+
negative_prompt = 'low quality, bad quality, boring, ugly',
|
| 37 |
guidance_scale = guidance_scale,
|
| 38 |
num_inference_steps = num_inference_steps,
|
| 39 |
width = width,
|