-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
28 lines (26 loc) · 799 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const imageUrl = "https://i.pinimg.com/736x/44/52/43/445243f506841e51fe6f6437d8dac696.jpg"; // Replace this with your image URL
// Define the data object with the header
const data = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'imgurl': imageUrl
}
};
// Make the fetch request to your Flask server
fetch('http://127.0.0.1:5000/analyze', data)
.then(response => {
// Handle the response
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json(); // Assuming the server returns JSON
})
.then(jsonResponse => {
// Handle the JSON response
console.log(jsonResponse);
})
.catch(error => {
// Handle errors
console.error('There was a problem with your fetch operation:', error);
});