对接快手的图转图+音视频字幕识别系统

基于php,无需apikey,无限次数无限间隔调用

<?php
// 接收GET请求参数
$model = isset($_GET['model']) ? $_GET['model'] : 'diffusion_cute_bunny';
$url = isset($_GET['url']) ? $_GET['url'] : '';

// 检查URL是否为空
if (empty($url)) {
    echo json_encode(['error' => 'URL cannot be empty']);
    exit;
}

// 使用curl向快手AI API发起请求
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://ai.kuaishou.com/api/effects/$model");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/x-www-form-urlencoded',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'typeId' => 2,
    'url' => $url,
]));

// 执行请求并获取响应
$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo json_encode(['error' => curl_error($ch)]);
    curl_close($ch);
    exit;
}
curl_close($ch);

// 将响应原样输出
echo $response;
?>

调用格式

http://你的域名/文件名.php?url=资源的直链&model=模型名字

注意:资源链接内的资源不要太大,你用什么模型就放什么对应的资源
模型名:

diffusion_xc炫彩diffusion_cutemoe1可爱Q萌diffusion_jpa2次元漫画diffusion_weddinggirl女神婚纱diffusion_haru春日女神diffusion_cheongsam旗袍女神diffusion_cute_bunny兔子风格diffusion_cute_lantern元宵节diffusion_redpack红包diffusion_diffuser_cutemoe春节diffusion_cute_xmas圣诞diffusion_chinese_style国风diffusion_gufeng古风diffusion_valentine情侣diffusion_jpagender_safe变性diffusion_my2023下一站diffusion_soccer足球风diffusion_soccerrand球员diffusion_jpa_xmas圣诞日漫diffusion_xmas_rand2圣诞美漫diffusion_wedding婚纱照diffusion_jpaany_3dphoto_safe万物拟人diffusion_jpapet_safe宠物拟人diffusion_human2pet人变狗diffusion_shinkai新海诚(场景)diffusion_chahua0插画(场景)diffusion_monet莫奈(场景)diffusion_vangogh梵高(场景)subtitle_generate提取音视频字幕

这个系列大家如果喜欢后续会更新文转音频,人脸关键点,人脸颜值,性别等信息等等的api

有服务器的姥搭建出来可以无偿放在评论区供大家使用

14 个赞

mark

2 个赞

是这个么?

2 个赞

是的

2 个赞

subtitle_generate这个功能帮大忙了,之前就想着能不能把剪映或者其他短视频平台的speech-to-text功能提取出来,没想到快手这边直接就有接口。

3 个赞

mark

3 个赞

后续的一些使用体验。
typeId设置2是传入链接网络资源,改为1就能使用本地文件。
subtitle_generate主要限制还是在音频文件大小上,尝试转录小于 50mb 长度为半个小时的音频也能输出。
但是转录应该只有中文和英文,由系统自动识别的(可夹杂输出)。我尝试用日语、印尼语、韩语都无法正常转录。

2 个赞