Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,41 @@ print("Running on:", device)
|
|
| 11 |
|
| 12 |
# Download and load model
|
| 13 |
base_path = hf_hub_download(repo_id="showlab/OmniConsistency", filename="OmniConsistency.safetensors", local_dir="./Model")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
pipe = FluxPipeline.from_pretrained(
|
| 16 |
"black-forest-labs/FLUX.1-dev",
|
|
@@ -19,6 +54,16 @@ pipe = FluxPipeline.from_pretrained(
|
|
| 19 |
|
| 20 |
set_single_lora(pipe.transformer, base_path, lora_weights=[1], cond_size=512)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
def generate_manga(input_image, prompt):
|
| 23 |
spatial_image = [input_image.convert("RGB")]
|
| 24 |
image = pipe(
|
|
|
|
| 11 |
|
| 12 |
# Download and load model
|
| 13 |
base_path = hf_hub_download(repo_id="showlab/OmniConsistency", filename="OmniConsistency.safetensors", local_dir="./Model")
|
| 14 |
+
lora_path = hf_hub_download(
|
| 15 |
+
repo_id="showlab/OmniConsistency",
|
| 16 |
+
filename="LoRAs/Ghibli_rank128_bf16.safetensors",
|
| 17 |
+
local_dir="./LoRAs"
|
| 18 |
+
)
|
| 19 |
+
lora_path = hf_hub_download(
|
| 20 |
+
repo_id="showlab/OmniConsistency",
|
| 21 |
+
filename="LoRAs/American_Cartoon_rank128_bf16.safetensors",
|
| 22 |
+
local_dir="./LoRAs"
|
| 23 |
+
)
|
| 24 |
+
lora_path = hf_hub_download(
|
| 25 |
+
repo_id="showlab/OmniConsistency",
|
| 26 |
+
filename="LoRAs/Chinese_Ink_rank128_bf16.safetensors",
|
| 27 |
+
local_dir="./LoRAs"
|
| 28 |
+
)
|
| 29 |
+
lora_path = hf_hub_download(
|
| 30 |
+
repo_id="showlab/OmniConsistency",
|
| 31 |
+
filename="LoRAs/Jojo_rank128_bf16.safetensors",
|
| 32 |
+
local_dir="./LoRAs"
|
| 33 |
+
)
|
| 34 |
+
lora_path = hf_hub_download(
|
| 35 |
+
repo_id="showlab/OmniConsistency",
|
| 36 |
+
filename="LoRAs/Line_rank128_bf16.safetensors",
|
| 37 |
+
local_dir="./LoRAs"
|
| 38 |
+
)
|
| 39 |
+
lora_path = hf_hub_download(
|
| 40 |
+
repo_id="showlab/OmniConsistency",
|
| 41 |
+
filename="LoRAs/Rick_Morty_rank128_bf16.safetensors",
|
| 42 |
+
local_dir="./LoRAs"
|
| 43 |
+
)
|
| 44 |
+
lora_path = hf_hub_download(
|
| 45 |
+
repo_id="showlab/OmniConsistency",
|
| 46 |
+
filename="LoRAs/Vector_rank128_bf16.safetensors",
|
| 47 |
+
local_dir="./LoRAs"
|
| 48 |
+
)
|
| 49 |
|
| 50 |
pipe = FluxPipeline.from_pretrained(
|
| 51 |
"black-forest-labs/FLUX.1-dev",
|
|
|
|
| 54 |
|
| 55 |
set_single_lora(pipe.transformer, base_path, lora_weights=[1], cond_size=512)
|
| 56 |
|
| 57 |
+
pipe.unload_lora_weights()
|
| 58 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Ghibli_rank128_bf16.safetensors")
|
| 59 |
+
pipe.load_lora_weights("./LoRAs", weight_name="American_Cartoon_rank128_bf16.safetensors")
|
| 60 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Chinese_Ink_rank128_bf16.safetensors")
|
| 61 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Jojo_rank128_bf16.safetensors")
|
| 62 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Line_rank128_bf16.safetensors")
|
| 63 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Rick_Morty_rank128_bf16.safetensors")
|
| 64 |
+
pipe.load_lora_weights("./LoRAs", weight_name="Vector_rank128_bf16.safetensors")
|
| 65 |
+
|
| 66 |
+
|
| 67 |
def generate_manga(input_image, prompt):
|
| 68 |
spatial_image = [input_image.convert("RGB")]
|
| 69 |
image = pipe(
|