stefutz101 commited on
Commit
ec974db
·
1 Parent(s): 43ddce2

fixed file request

Browse files
Files changed (1) hide show
  1. static/script.js +10 -4
static/script.js CHANGED
@@ -54,12 +54,18 @@ const sendRequest = async (request, mode) => {
54
  body: JSON.stringify(request)
55
  });
56
  } else {
 
 
 
 
 
 
 
 
 
57
  response = await fetch('/predict_batch', {
58
  method: 'POST',
59
- headers: {
60
- 'Content-Type': 'application/json'
61
- },
62
- body: JSON.stringify(request)
63
  });
64
  }
65
 
 
54
  body: JSON.stringify(request)
55
  });
56
  } else {
57
+ const formData = new FormData();
58
+
59
+ // Append all properties of the request object to the FormData
60
+ for (const key in request) {
61
+ if (request.hasOwnProperty(key)) {
62
+ formData.append(key, request[key]);
63
+ }
64
+ }
65
+
66
  response = await fetch('/predict_batch', {
67
  method: 'POST',
68
+ body: formData
 
 
 
69
  });
70
  }
71