Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,8 @@ translator = Translator()
|
|
15 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
16 |
# Constants
|
17 |
model = "black-forest-labs/FLUX.1-dev"
|
|
|
|
|
18 |
MAX_SEED = np.iinfo(np.int32).max
|
19 |
|
20 |
CSS = """
|
@@ -32,6 +34,8 @@ JS = """function () {
|
|
32 |
|
33 |
if torch.cuda.is_available():
|
34 |
pipe = FluxPipeline.from_pretrained(model, torch_dtype=torch.bfloat16)
|
|
|
|
|
35 |
|
36 |
|
37 |
def scrape_lora_link(url):
|
@@ -120,8 +124,8 @@ def generate_image(
|
|
120 |
examples = [
|
121 |
["close up portrait, Amidst the interplay of light and shadows in a photography studio,a soft spotlight traces the contours of a face,highlighting a figure clad in a sleek black turtleneck. The garment,hugging the skin with subtle luxury,complements the Caucasian model's understated makeup,embodying minimalist elegance. Behind,a pale gray backdrop extends,its fine texture shimmering subtly in the dim light,artfully balancing the composition and focusing attention on the subject. In a palette of black,gray,and skin tones,simplicity intertwines with profundity,as every detail whispers untold stories.",0.9,"Shakker-Labs/AWPortrait-FL",""],
|
122 |
["Caucasian,The image features a young woman of European descent standing in an studio setting,surrounded by silk. (She is wearing a silk dress),paired with a bold. Her brown hair is wet and tousled,falling naturally around her face,giving her a raw and edgy look. The woman has an intense and direct gaze,adding to the dramatic feel of the image. The backdrop is flowing silk,big silk. The overall composition blends elements of fashion and nature,creating a striking and powerful visual",0.9,"Shakker-Labs/AWPortrait-FL",""],
|
123 |
-
["A young Japanese girl, profile, blue hours, Tokyo tower
|
124 |
-
["A young asian girl
|
125 |
]
|
126 |
|
127 |
|
@@ -186,18 +190,19 @@ with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
|
|
186 |
minimum=0.1,
|
187 |
maximum=1.0,
|
188 |
step=0.1,
|
189 |
-
value=
|
190 |
)
|
191 |
lora_add = gr.Textbox(
|
192 |
label="Flux LoRA",
|
193 |
info="Copy the HF LoRA model name here",
|
194 |
lines=1,
|
|
|
195 |
)
|
196 |
lora_word = gr.Textbox(
|
197 |
label="Add Flux LoRA Trigger Word",
|
198 |
info="Add the Trigger Word",
|
199 |
lines=1,
|
200 |
-
value="",
|
201 |
)
|
202 |
load_lora = gr.Button(value="Load LoRA", variant='secondary')
|
203 |
|
|
|
15 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
16 |
# Constants
|
17 |
model = "black-forest-labs/FLUX.1-dev"
|
18 |
+
default_lora = "Shakker-Labs/FilmPortrait"
|
19 |
+
default_weight_name = 'filmfotos.safetensors'
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
|
22 |
CSS = """
|
|
|
34 |
|
35 |
if torch.cuda.is_available():
|
36 |
pipe = FluxPipeline.from_pretrained(model, torch_dtype=torch.bfloat16)
|
37 |
+
pipe.load_lora_weights(default_lora, weight_name = default_weight_name) # default load lora
|
38 |
+
pipe.fuse_lora(lora_scale=0.9)
|
39 |
|
40 |
|
41 |
def scrape_lora_link(url):
|
|
|
124 |
examples = [
|
125 |
["close up portrait, Amidst the interplay of light and shadows in a photography studio,a soft spotlight traces the contours of a face,highlighting a figure clad in a sleek black turtleneck. The garment,hugging the skin with subtle luxury,complements the Caucasian model's understated makeup,embodying minimalist elegance. Behind,a pale gray backdrop extends,its fine texture shimmering subtly in the dim light,artfully balancing the composition and focusing attention on the subject. In a palette of black,gray,and skin tones,simplicity intertwines with profundity,as every detail whispers untold stories.",0.9,"Shakker-Labs/AWPortrait-FL",""],
|
126 |
["Caucasian,The image features a young woman of European descent standing in an studio setting,surrounded by silk. (She is wearing a silk dress),paired with a bold. Her brown hair is wet and tousled,falling naturally around her face,giving her a raw and edgy look. The woman has an intense and direct gaze,adding to the dramatic feel of the image. The backdrop is flowing silk,big silk. The overall composition blends elements of fashion and nature,creating a striking and powerful visual",0.9,"Shakker-Labs/AWPortrait-FL",""],
|
127 |
+
["A young Japanese girl, profile, blue hours, Tokyo tower",0.9,"Shakker-Labs/FilmPortrait","filmfotos, film grain, reversal film photography"],
|
128 |
+
["A young asian girl",0.9,"Shakker-Labs/FilmPortrait","filmfotos, film grain, reversal film photography"]
|
129 |
]
|
130 |
|
131 |
|
|
|
190 |
minimum=0.1,
|
191 |
maximum=1.0,
|
192 |
step=0.1,
|
193 |
+
value=0.9,
|
194 |
)
|
195 |
lora_add = gr.Textbox(
|
196 |
label="Flux LoRA",
|
197 |
info="Copy the HF LoRA model name here",
|
198 |
lines=1,
|
199 |
+
value="Shakker-Labs/FilmPortrait",
|
200 |
)
|
201 |
lora_word = gr.Textbox(
|
202 |
label="Add Flux LoRA Trigger Word",
|
203 |
info="Add the Trigger Word",
|
204 |
lines=1,
|
205 |
+
value="filmfotos, film grain, reversal film photography",
|
206 |
)
|
207 |
load_lora = gr.Button(value="Load LoRA", variant='secondary')
|
208 |
|