跳转到主要内容

非官方Black Forest Labs API客户端

项目描述

Black Forest Labs API客户端

这是一个与Black Forest Labs API交互的非官方Python客户端。

$ export BFL_API_KEY="..."
import black_forest_labs
import time

task = black_forest_labs.generate(
    "flux-pro",
    prompt="ein fantastisches bild",
)

print(f"Task created with id `{task.id}`")

print("Polling for results...", end="", flush=True)
while not task.is_done:
    print(".", end="", flush=True)
    task = black_forest_labs.get_result(task.id)
    time.sleep(1)

print(f"\nTask finished with status `{task.status}`")
if task.result:
    print(f"Prompt: {task.result.prompt}")
    print(f"Image URL: {task.result.sample}")
Task created with id `ce9e065d-dc90-4633-9c1e-44ea839ed569`
Polling for results............
Task finished with status `Ready`
Prompt: ein fantastisches bild
Image URL: https://bflapistorage.blob.core.windows.net/public/db43e36806f74c1a9c6972127c9d71ea/sample.jpg

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码分发

black_forest_labs-1.0.0.tar.gz (5.6 kB 查看哈希值)

上传时间: 源代码

构建分发

black_forest_labs-1.0.0-py3-none-any.whl (5.0 kB 查看哈希值)

上传时间: Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面