Skip to content

Commit

Permalink
fix: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhjz committed Jan 11, 2024
1 parent 8111d1a commit 7bbe09e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions docs/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ img_data = resp["body"]["data"][0]["image"]
img = Image.open(io.BytesIO(img_data))
```

#### **图生文**
千帆平台也提供了图+文生文功能,千帆SDK支持用户调用SDK来获取结果,以快速集成多模态能力到大模型应用中。

以下是一个使用示例
```python
i2t = qianfan.Image2Text(endpoint="....")
resp = i2t.do(prompt="Rag doll cat", "9j/4AAQSkZJRgABAQAAAQABAAD/xxxxx")
print(resp["result"])
```

#### **批量推理**

上述模型均提供了 `batch_do` 和异步的 `abatch_do` 方法,方便用户批量进行推理,并通过 `worker_num` 来控制并发量。
Expand Down
4 changes: 2 additions & 2 deletions src/qianfan/resources/images/image2text.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def do(
as follows:
```
Text2Image().do(prompt = ..., steps=20)
Image2Text(endpoint="").do(prompt="", image="", xxx=vvv)
```
"""
Expand Down Expand Up @@ -220,7 +220,7 @@ async def ado(
as follows:
```
Text2Image().do(prompt = ..., steps=20)
Image2Text(endpoint="").ado(prompt="", image="", xx=vv)
```
"""
Expand Down
2 changes: 1 addition & 1 deletion src/qianfan/tests/image2text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

"""
Unit test for Txt2Image
Unit test for Image2Text
"""

import time
Expand Down

0 comments on commit 7bbe09e

Please sign in to comment.