diff --git a/README.md b/README.md
index 7fadd94..8630314 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@
+
## 1. Introduction
@@ -56,6 +57,9 @@
- `Baidu ERNIE irag-1.0`
- `Stable Diffusion 3.5 large turbo`
- `Luma Photon`
+ - `Ideogram V_2`
+
+
项目架构流程如下:
```mermaid
@@ -239,6 +243,12 @@ MLLM 模型主要用于自动切片后的切片标题生成,此功能默认关
请自行[注册账号](https://lumalabs.ai/api/keys)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `LUMA_API_KEY` 中。
+##### 3.3.7 Ideogram V_2 模型
+
+> 如需使用 Ideogram V_2 模型,请将 `IMAGE_GEN_MODEL` 参数设置为 `ideogram`。
+
+请自行[注册账号](https://ideogram.ai/manage-api)并申请 API Key,填写到 `bilive.toml` 文件中对应的 `IDEOGRAM_API_KEY` 中。
+
#### 4. bilitool 登录
> 由于一般日志打印不出二维码效果(docker 的日志不确定是否能打印,等发布新image时再修改,docker 版本请先参考文档 [bilive](https://bilive.timerring.com),本 README 只针对源码部署),所以这步需要提前在机器上安装 [bilitool](https://github.com/timerring/bilitool):
diff --git a/assets/ideogram.svg b/assets/ideogram.svg
new file mode 100644
index 0000000..ba6f7f6
--- /dev/null
+++ b/assets/ideogram.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/bilive.toml b/bilive.toml
index 8992de9..2292541 100644
--- a/bilive.toml
+++ b/bilive.toml
@@ -37,7 +37,7 @@ qwen_api_key = "" # Apply for your own Qwen API key at https://bailian.console.a
[cover]
generate_cover = false # whether to generate cover
-image_gen_model = "minimax" # the image generation model, can be "minimax" or "siliconflow" or "tencent" or "baidu" or "stability" or "luma"
+image_gen_model = "minimax" # the image generation model, can be "minimax" or "siliconflow" or "tencent" or "baidu" or "stability" or "luma" or "ideogram"
minimax_api_key = "" # Apply for your own Minimax API key at https://platform.minimaxi.com/user-center/basic-information/interface-key
siliconflow_api_key = "" # Apply for your own SiliconFlow API key at https://cloud.siliconflow.cn/i/3Szr5BVg
tencent_secret_id = "" # Apply for your own Tencent Cloud API key at https://console.cloud.tencent.com/cam/capi
@@ -45,3 +45,4 @@ tencent_secret_key = "" # Apply for your own Tencent Cloud secret key as above
baidu_api_key = "" # Apply for your own Baidu API key at https://console.bce.baidu.com/iam/key/list
stability_api_key = "" # Apply for your own Stability API key at https://platform.stability.ai/account/keys
luma_api_key = "" # Apply for your own Luma API key at https://lumalabs.ai/api/keys
+ideogram_api_key = "" # Apply for your own Ideogram API key at https://ideogram.ai/manage-api
diff --git a/src/config.py b/src/config.py
index 532b833..569d569 100644
--- a/src/config.py
+++ b/src/config.py
@@ -80,4 +80,5 @@ TENCENT_SECRET_ID = config.get('cover', {}).get('tencent_secret_id')
TENCENT_SECRET_KEY = config.get('cover', {}).get('tencent_secret_key')
BAIDU_API_KEY = config.get('cover', {}).get('baidu_api_key')
STABILITY_API_KEY = config.get('cover', {}).get('stability_api_key')
-LUMA_API_KEY = config.get('cover', {}).get('luma_api_key')
\ No newline at end of file
+LUMA_API_KEY = config.get('cover', {}).get('luma_api_key')
+IDEOGRAM_API_KEY = config.get('cover', {}).get('ideogram_api_key')
\ No newline at end of file
diff --git a/src/cover/cover_generator.py b/src/cover/cover_generator.py
index 4dc6c1e..45b7b21 100644
--- a/src/cover/cover_generator.py
+++ b/src/cover/cover_generator.py
@@ -77,6 +77,10 @@ def cover_generator(model_type):
from .image_model_sdk.luma_sdk import luma_generate_cover
return luma_generate_cover(cover_path)
+ elif model_type == "ideogram":
+ from .image_model_sdk.ideogram_sdk import ideogram_generate_cover
+
+ return ideogram_generate_cover(cover_path)
else:
upload_log.error(f"Unsupported model type: {model_type}")
return None
diff --git a/src/cover/image_model_sdk/ideogram_sdk.py b/src/cover/image_model_sdk/ideogram_sdk.py
new file mode 100644
index 0000000..28bafae
--- /dev/null
+++ b/src/cover/image_model_sdk/ideogram_sdk.py
@@ -0,0 +1,51 @@
+import requests
+import json
+import os
+import time
+from src.config import IDEOGRAM_API_KEY
+
+
+def ideogram_generate_cover(your_file_path):
+ """Generater cover image using ideogram V_2 model
+ Args:
+ your_file_path: str, path to the image file
+ Returns:
+ str, local download path of the generated cover image file
+ """
+ try:
+ url = "https://api.ideogram.ai/remix"
+
+ files = {"image_file": open(your_file_path, "rb")}
+ payload = {
+ "image_request": json.dumps(
+ {
+ "prompt": "This is a video screenshot, please generate a cover in the style of a manga",
+ "aspect_ratio": "ASPECT_10_16",
+ "image_weight": 75,
+ "magic_prompt_option": "ON",
+ "model": "V_2",
+ }
+ )
+ }
+ headers = {"Api-Key": f"{IDEOGRAM_API_KEY}"}
+
+ response = requests.post(url, data=payload, files=files, headers=headers)
+ if response.status_code == 200:
+ response_json = response.json()
+ image_url = response_json["data"][0]["url"]
+ img_data = requests.get(image_url).content
+ cover_name = time.strftime("%Y%m%d%H%M%S") + ".png"
+ temp_cover_path = os.path.join(os.path.dirname(your_file_path), cover_name)
+ with open(temp_cover_path, "wb") as handler:
+ handler.write(img_data)
+ os.remove(your_file_path)
+ return temp_cover_path
+ else:
+ raise Exception(response.text)
+ except Exception as e:
+ print(e, flush=True)
+ return None
+
+
+if __name__ == "__main__":
+ print(ideogram_generate_cover(""))