5000000) { $error = "الصورة كبيرة جداً، يرجى اختيار صورة أقل من 5 ميجابايت."; } elseif ($file['error'] !== UPLOAD_ERR_OK) { $error = "حدث خطأ أثناء رفع الملف."; } else { $image_data = file_get_contents($file["tmp_name"]); // 2. إعداد الاتصال بالـ Worker $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $worker_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $image_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Content-Type: application/octet-stream", "Accept: application/json" ]); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($response) { $output = json_decode($response, true); if ($http_code == 200) { // فحص إذا كان الموديل قيد التحميل if (isset($output['status']) && $output['status'] === 'loading') { $loading_msg = "الذكاء الاصطناعي يستعد الآن (Loading model). يرجى الانتظار 20 ثانية ثم حاول الرفع مرة أخرى."; } elseif (isset($output[0]['generated_text'])) { $result_prompt = $output[0]['generated_text']; } elseif (is_array($output) && isset($output['error'])) { $error = "خطأ من الخادم: " . $output['error']; } else { $result_prompt = strip_tags($response); // إذا عاد كصيغة نصية } } else { $error = "فشل الاتصال بالـ Worker. كود الخطأ: " . $http_code; } } else { $error = "لا يوجد استجابة من السيرفر، يرجى التأكد من إعدادات الـ Worker."; } } } ?> Image to Prompt | تحويل الصور لوصف ذكي

ImagePrompt.org

حول أي صورة إلى Prompt احترافي للذكاء الاصطناعي

اسحب صورتك هنا أو انقر للرفع

النتيجة (Prompt):