Spaces:
Running
on
Zero
Running
on
Zero
aifeifei798
commited on
Commit
•
cd732b5
1
Parent(s):
a0d7fba
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,29 @@ import random
|
|
4 |
import spaces
|
5 |
import torch
|
6 |
from diffusers import DiffusionPipeline
|
|
|
7 |
|
8 |
dtype = torch.bfloat16
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
|
11 |
pipe = DiffusionPipeline.from_pretrained("aifeifei798/DarkIdol-flux-v1", torch_dtype=dtype).to(device)
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
MAX_SEED = np.iinfo(np.int32).max
|
14 |
MAX_IMAGE_SIZE = 2048
|
15 |
|
@@ -44,8 +61,8 @@ css="""
|
|
44 |
with gr.Blocks(css=css) as demo:
|
45 |
|
46 |
with gr.Column(elem_id="col-container"):
|
47 |
-
gr.Markdown(f"""#
|
48 |
-
|
49 |
""")
|
50 |
|
51 |
with gr.Row():
|
|
|
4 |
import spaces
|
5 |
import torch
|
6 |
from diffusers import DiffusionPipeline
|
7 |
+
from huggingface_hub import hf_hub_download
|
8 |
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
pipe = DiffusionPipeline.from_pretrained("aifeifei798/DarkIdol-flux-v1", torch_dtype=dtype).to(device)
|
13 |
|
14 |
+
pipe.load_lora_weights(
|
15 |
+
hf_hub_download("aifeifei798/feifei-flux-lora-v1", "feifei.safetensors"),
|
16 |
+
adapter_name="feifei",
|
17 |
+
)
|
18 |
+
|
19 |
+
pipe.set_adapters(
|
20 |
+
["feifei"],
|
21 |
+
adapter_weights=[0.65],
|
22 |
+
)
|
23 |
+
pipe.fuse_lora(
|
24 |
+
adapter_name=["feifei"],
|
25 |
+
lora_scale=1.0,
|
26 |
+
)
|
27 |
+
pipe.unload_lora_weights()
|
28 |
+
torch.cuda.empty_cache()
|
29 |
+
|
30 |
MAX_SEED = np.iinfo(np.int32).max
|
31 |
MAX_IMAGE_SIZE = 2048
|
32 |
|
|
|
61 |
with gr.Blocks(css=css) as demo:
|
62 |
|
63 |
with gr.Column(elem_id="col-container"):
|
64 |
+
gr.Markdown(f"""# DarkIdol-flux-FeiFei
|
65 |
+
DarkIdol-flux-FeiFei is a text-to-image AI model designed to create aesthetic, detailed and diverse images from textual prompts in just 4-8 steps. It offers enhanced performance in image quality, typography, understanding complex prompts, and resource efficiency.
|
66 |
""")
|
67 |
|
68 |
with gr.Row():
|