{% extends 'dashboard/base.html' %} {% load static %} {% block title %}Flood Detection Testing - Peza{% endblock %} {% block content %}

Flood Detection Testing

Test flood detection on your images

Endpoint

POST {{ base_url }}/api/flood-detection/

Header: X-API-Key: your-key

Body: multipart/form-data • field: image

Test Upload

cURL

curl -X POST {{ base_url }}/api/flood-detection/ \ -H "X-API-Key: YOUR_KEY" \ -F "image=@/path/to/flood.jpg"

Result

Upload image to begin

Code Examples

Python (requests)
import requests

url = "{{ base_url }}/api/flood-detection/"
headers = {"X-API-Key": "YOUR_API_KEY"}
files = {"image": open("flood_image.jpg", "rb")}

response = requests.post(url, headers=headers, files=files)
print(response.json())
PHP (cURL)
$url = "{{ base_url }}/api/flood-detection/";
$apiKey = "YOUR_API_KEY";
$file = new CURLFile('flood_image.jpg', 'image/jpeg', 'image.jpg');

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: $apiKey"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['image' => $file]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
Node.js (axios + form-data)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();
form.append('image', fs.createReadStream('flood_image.jpg'));

axios.post('{{ base_url }}/api/flood-detection/', form, {
  headers: {
    ...form.getHeaders(),
    'X-API-Key': 'YOUR_API_KEY'
  }
})
.then(res => console.log(res.data))
.catch(err => console.error(err));
{% endblock %}