Skip to content

Commit 0b8cbb1

Browse files
Fix fal client snippet for LoRAs (#1393)
Fixes #1347 (comment).
1 parent 904964c commit 0b8cbb1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
{% if provider == "fal-ai" %}
22
import fal_client
33

4+
{% if providerInputs.asObj.loras is defined and providerInputs.asObj.loras != none %}
45
result = fal_client.subscribe(
56
"{{ providerModelId }}",
67
arguments={
78
"prompt": {{ inputs.asObj.inputs }},
9+
"loras":{{ providerInputs.asObj.loras | tojson }},
810
},
911
)
12+
{% else %}
13+
result = fal_client.subscribe(
14+
"{{ providerModelId }}",
15+
arguments={
16+
"prompt": {{ inputs.asObj.inputs }},
17+
},
18+
)
19+
{% endif %}
1020
print(result)
1121
{% endif %}

packages/tasks-gen/snippets-fixtures/text-to-image--lora/python/fal_client/0.fal-ai.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"<fal-ai alias for openfree/flux-chatgpt-ghibli-lora>",
55
arguments={
66
"prompt": "Astronaut riding a horse",
7+
"loras":[{"path": "https://huggingface.co/openfree/flux-chatgpt-ghibli-lora/resolve/main/<path to LoRA weights in .safetensors format>", "scale": 1}],
78
},
89
)
10+
911
print(result)

packages/tasks-gen/snippets-fixtures/text-to-image/python/fal_client/0.fal-ai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
"prompt": "Astronaut riding a horse",
77
},
88
)
9+
910
print(result)

0 commit comments

Comments
 (0)