Spaces:
Sleeping
Sleeping
use Flux2KleinPipeline + unpin transformers + klein-tuned defaults
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import random
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
-
from diffusers import
|
| 7 |
|
| 8 |
BASE = "black-forest-labs/FLUX.2-klein-4B"
|
| 9 |
LORA = "noema-art/impresstation-klein"
|
|
@@ -12,7 +12,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
| 12 |
MAX_SEED = 2**31 - 1
|
| 13 |
|
| 14 |
dtype = torch.bfloat16
|
| 15 |
-
pipe =
|
| 16 |
pipe.load_lora_weights(LORA, adapter_name="impresstation", token=HF_TOKEN)
|
| 17 |
pipe.to("cuda")
|
| 18 |
|
|
@@ -57,8 +57,8 @@ with gr.Blocks(css=CSS, title="ImpressStation — PS2-ify your image") as demo:
|
|
| 57 |
inp = gr.Image(label="Your image", type="pil", height=360)
|
| 58 |
extra = gr.Textbox(label="Describe / steer (optional)", placeholder="a determined young woman with red pigtails")
|
| 59 |
with gr.Accordion("Settings", open=False):
|
| 60 |
-
steps = gr.Slider(
|
| 61 |
-
guidance = gr.Slider(1.0,
|
| 62 |
seed = gr.Slider(0, MAX_SEED, value=42, step=1, label="Seed")
|
| 63 |
randomize = gr.Checkbox(value=True, label="Randomize seed")
|
| 64 |
go = gr.Button("PS2-ify →", variant="primary")
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
+
from diffusers import Flux2KleinPipeline
|
| 7 |
|
| 8 |
BASE = "black-forest-labs/FLUX.2-klein-4B"
|
| 9 |
LORA = "noema-art/impresstation-klein"
|
|
|
|
| 12 |
MAX_SEED = 2**31 - 1
|
| 13 |
|
| 14 |
dtype = torch.bfloat16
|
| 15 |
+
pipe = Flux2KleinPipeline.from_pretrained(BASE, torch_dtype=dtype, token=HF_TOKEN)
|
| 16 |
pipe.load_lora_weights(LORA, adapter_name="impresstation", token=HF_TOKEN)
|
| 17 |
pipe.to("cuda")
|
| 18 |
|
|
|
|
| 57 |
inp = gr.Image(label="Your image", type="pil", height=360)
|
| 58 |
extra = gr.Textbox(label="Describe / steer (optional)", placeholder="a determined young woman with red pigtails")
|
| 59 |
with gr.Accordion("Settings", open=False):
|
| 60 |
+
steps = gr.Slider(4, 30, value=8, step=1, label="Steps")
|
| 61 |
+
guidance = gr.Slider(1.0, 6.0, value=2.5, step=0.1, label="Guidance")
|
| 62 |
seed = gr.Slider(0, MAX_SEED, value=42, step=1, label="Seed")
|
| 63 |
randomize = gr.Checkbox(value=True, label="Randomize seed")
|
| 64 |
go = gr.Button("PS2-ify →", variant="primary")
|