Skip to content

Commit 656f292

Browse files
committed
added test funciton and editted model name mismatch error on replicate
1 parent 2ee35d0 commit 656f292

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

api/llm/tools.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ def generate_image(
3737
}
3838

3939
# Generate image using Replicate
40+
version = (
41+
"stability-ai/sdxl:" "7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc"
42+
)
4043
output = replicate.run(
41-
"stability-ai/sdxl:7762fd07cf82c948538e41f63f77d6 \
42-
85e02b063e37e496e96eefd46c929f9bdc",
44+
version,
4345
input=input,
4446
)
4547

@@ -86,3 +88,16 @@ def generate_image(
8688
del image_data
8789

8890
return [generate_image]
91+
92+
93+
if __name__ == "__main__":
94+
# Test the tool
95+
generate_image = initialize_tools()[0]
96+
output = generate_image.invoke(
97+
{
98+
"prompt": "A woman in a beautiful sunset over a calm ocean",
99+
"user_id": "123",
100+
"image_url": "https://replicate.delivery/pbxt/N55l5TWGh8mSlNzW8usReoaNhGbFwvLeZR3TX1NL4pd2Wtfv/replicate-prediction-f2d25rg6gnrma0cq257vdw2n4c.png",
101+
}
102+
)
103+
print(output)

0 commit comments

Comments
 (0)