Cosplay动漫人物生成时报错 #478
Unanswered
RuipingWang1986
asked this question in
Q&A
Replies: 1 comment
-
您好,按照您提供的request_id和task_id看,图像生成任务是成功的,应该是查询任务的dashone URL不太对 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
"
import os
import sys
import time
import requests
from pathlib import PurePosixPath
配置环境变量;如果您已经提前将api-key提前配置到您的运行环境中,可以省略这个步骤
os.environ['DASHSCOPE_API_KEY'] = 'our_DASHSCOPE_API_KEY' # 替换为您的 Dashscope API Key
dashscope_api_key = os.getenv('DASHSCOPE_API_KEY')
os.environ['SM_MS_API_KEY'] = 'our_SM_MS_API_KEY' # 替换为您的 sm.ms API Key
sm_ms_api_key = os.getenv('SM_MS_API_KEY')
用于存储对话历史记录的列表
dialog_history = []
def upload_image(file_path):
url = 'https://sm.ms/api/v2/upload'
headers = {'Authorization': sm_ms_api_key}
files = {'smfile': open(file_path, 'rb')}
def generate_image(face_image_url, template_image_url):
# 请求参数准备数据
data = {
"model": "wanx-style-cosplay-v1",
"input": {
"model_index": 1,
"face_image_url": face_image_url,
"template_image_url": template_image_url
}
}
def get_generated_image(task_id):
url = 'https://dashscope.aliyuncs.com/api/v1/services/aigc/image-generation/generation/results'
headers = {
'Authorization': f'Bearer {dashscope_api_key}',
'Content-Type': 'application/json'
}
def main():
print("您好,我是图像合成助手,能够帮助您生成图片。请告诉我您想要生成的图片内容:")
if name == "main":
main()"
运行上述代码后,出现如下错误:
您好,我是图像合成助手,能够帮助您生成图片。请告诉我您想要生成的图片内容:
请输入本地人脸图像路径:wrp.jpg
请输入本地模板图像路径:SDS.jpg
图像已经存在,图像 URL: https://s2.loli.net/2024/06/11/XokMJrFq1ilu8fW.jpg
图像已经存在,图像 URL: https://s2.loli.net/2024/06/11/QqfxCBmgtdo7XWF.jpg
已上传并确认的图像路径 - Face: https://s2.loli.net/2024/06/11/XokMJrFq1ilu8fW.jpg, Template: https://s2.loli.net/2024/06/11/QqfxCBmgtdo7XWF.jpg
请求参数: {'model': 'wanx-style-cosplay-v1', 'input': {'model_index': 1, 'face_image_url': 'https://s2.loli.net/2024/06/11/XokMJrFq1ilu8fW.jpg', 'template_image_url': 'https://s2.loli.net/2024/06/11/QqfxCBmgtdo7XWF.jpg'}}
HTTP 状态码: 200
响应内容: {"output":{"task_status":"PENDING","task_id":"3b7305ae-8fce-4500-8968-3a8c1f47a05c"},"request_id":"9566d7d4-1489-96ec-994e-645372cc2810"}
任务已提交,任务ID: 3b7305ae-8fce-4500-8968-3a8c1f47a05c
**发生错误:获取任务状态失败,状态码: 400, 错误代码: InvalidParameter, 错误信息: url error, please check url!**能否麻烦帮忙看一下如何解决,或者有没有可供运行的python代码呢?
Beta Was this translation helpful? Give feedback.
All reactions