-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
缺少依赖 #5
Comments
我想问一下您该程序的运行顺序,配置好环境后是在upload中放如我想抠图的程序后 直接运行app.py这个程序嘛 |
啟動.py之後 打開預設服務 http://127.0.0.1:8000/ 另外可透過其他程式來post到這個服務ip, 如我這裡php範例 $server = "http://127.0.0.1:8000";
$image_path = "testimg/66974639.jpg";
$model_name = "people"; // people,universal
// 初始化 cURL
$ch = curl_init();
// 設置 cURL 請求
curl_setopt($ch, CURLOPT_URL, $server . '/matting');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
// 設置要上傳的文件和其他數據
$fields = [
'image' => new CURLFile($image_path), // 這裡使用 CURLFile 上傳文件
'model' => $model_name
];
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
// 執行 cURL 請求
$response = curl_exec($ch);
// 檢查是否有錯誤
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
} else {
// 解析 JSON 響應
$json_data = json_decode($response, true);
if ($json_data) {
$image_url = $json_data['result_image_url'];
$mask_url = $json_data['mask_image_url'];
echo "image_url: " . $server . $image_url . "<br>";
echo "mask_url: " . $server . $mask_url . "<br>";
} else {
echo "Invalid JSON response.\n";
}
}
// 關閉 cURL
curl_close($ch); 個人安裝過程除了需額外加一些模組還要注意版本 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
本地运行,报缺少模块,又安装了以下模块才正常运行:
pillow
addict
oss2
datasets==2.18.0
simplejson
sortedcontainers
抠图效果很好,感谢
The text was updated successfully, but these errors were encountered: