pva22
commited on
Commit
·
0b74261
1
Parent(s):
39aef48
fix bug
Browse files
app.py
CHANGED
|
@@ -45,7 +45,7 @@ def get_lora_sd_pipeline(
|
|
| 45 |
if dtype in (torch.float16, torch.bfloat16):
|
| 46 |
pipe.unet.half()
|
| 47 |
pipe.text_encoder.half()
|
| 48 |
-
|
| 49 |
return pipe
|
| 50 |
|
| 51 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -93,21 +93,21 @@ def infer(
|
|
| 93 |
pipe.safety_checker = None
|
| 94 |
print(f"LoRA adapter loaded: {pipe.unet.active_adapters}")
|
| 95 |
|
| 96 |
-
# на вызов pipe с эмбеддингами
|
| 97 |
params = {
|
| 98 |
-
'
|
| 99 |
-
'
|
| 100 |
'guidance_scale': guidance_scale,
|
| 101 |
'num_inference_steps': num_inference_steps,
|
| 102 |
'width': width,
|
| 103 |
'height': height,
|
| 104 |
'generator': generator,
|
| 105 |
}
|
| 106 |
-
|
| 107 |
return pipe(**params).images[0], seed
|
| 108 |
|
| 109 |
|
| 110 |
examples = [
|
|
|
|
| 111 |
"A cartoon-style sticker of Elon Musk shaking hands with Donald Trump. Both figures have exaggerated facial expressions, with Musk grinning confidently and Trump giving a signature thumbs-up. The background features a patriotic red, white, and blue color scheme with fireworks exploding behind them.",
|
| 112 |
"A cyberpunk-themed cartoon sticker of Elon Musk standing atop a futuristic Tesla spaceship. He wears a sleek, neon-lit jacket with glowing circuits, while the city skyline behind him is filled with holographic billboards displaying SpaceX and Neuralink logos. His sunglasses reflect the distant stars, adding to the sci-fi aesthetic.",
|
| 113 |
"A medieval fantasy sticker of Elon Musk depicted as a wizard. He holds a glowing blue orb in one hand and a spellbook in the other, wearing a long, starry robe with intricate golden details. His expression is both wise and mischievous, as if he's about to reveal the secrets of the universe. The background features a mystical castle and a dragon flying in the sky.",
|
|
@@ -155,7 +155,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 155 |
max_lines=1,
|
| 156 |
placeholder="Enter a negative prompt",
|
| 157 |
visible=True,
|
| 158 |
-
value="
|
| 159 |
)
|
| 160 |
|
| 161 |
seed = gr.Slider(
|
|
|
|
| 45 |
if dtype in (torch.float16, torch.bfloat16):
|
| 46 |
pipe.unet.half()
|
| 47 |
pipe.text_encoder.half()
|
| 48 |
+
|
| 49 |
return pipe
|
| 50 |
|
| 51 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 93 |
pipe.safety_checker = None
|
| 94 |
print(f"LoRA adapter loaded: {pipe.unet.active_adapters}")
|
| 95 |
|
|
|
|
| 96 |
params = {
|
| 97 |
+
'prompt': prompt,
|
| 98 |
+
'negative_prompt': negative_prompt,
|
| 99 |
'guidance_scale': guidance_scale,
|
| 100 |
'num_inference_steps': num_inference_steps,
|
| 101 |
'width': width,
|
| 102 |
'height': height,
|
| 103 |
'generator': generator,
|
| 104 |
}
|
| 105 |
+
|
| 106 |
return pipe(**params).images[0], seed
|
| 107 |
|
| 108 |
|
| 109 |
examples = [
|
| 110 |
+
"Cartoon sticker of sad Elon Musk",
|
| 111 |
"A cartoon-style sticker of Elon Musk shaking hands with Donald Trump. Both figures have exaggerated facial expressions, with Musk grinning confidently and Trump giving a signature thumbs-up. The background features a patriotic red, white, and blue color scheme with fireworks exploding behind them.",
|
| 112 |
"A cyberpunk-themed cartoon sticker of Elon Musk standing atop a futuristic Tesla spaceship. He wears a sleek, neon-lit jacket with glowing circuits, while the city skyline behind him is filled with holographic billboards displaying SpaceX and Neuralink logos. His sunglasses reflect the distant stars, adding to the sci-fi aesthetic.",
|
| 113 |
"A medieval fantasy sticker of Elon Musk depicted as a wizard. He holds a glowing blue orb in one hand and a spellbook in the other, wearing a long, starry robe with intricate golden details. His expression is both wise and mischievous, as if he's about to reveal the secrets of the universe. The background features a mystical castle and a dragon flying in the sky.",
|
|
|
|
| 155 |
max_lines=1,
|
| 156 |
placeholder="Enter a negative prompt",
|
| 157 |
visible=True,
|
| 158 |
+
value="monochrome, lowres, bad anatomy, worst quality, low quality, medical mask"
|
| 159 |
)
|
| 160 |
|
| 161 |
seed = gr.Slider(
|