Spaces:
Build error
Build error
Commit
·
a0ea772
1
Parent(s):
c758574
changed local url to backend service
Browse files
instance-labeler/app/canvas.tsx
CHANGED
@@ -171,7 +171,7 @@ export default function Canvas({ imageUrl, imageName }: { imageUrl: string, imag
|
|
171 |
pointsRef.current = points;
|
172 |
|
173 |
const res = await axios.post(
|
174 |
-
|
175 |
{
|
176 |
points: points,
|
177 |
labels: labels,
|
@@ -230,7 +230,7 @@ export default function Canvas({ imageUrl, imageName }: { imageUrl: string, imag
|
|
230 |
masks.push(labelData);
|
231 |
}
|
232 |
|
233 |
-
const res = await axios.put(
|
234 |
{
|
235 |
masks: masks,
|
236 |
labels: classList,
|
@@ -245,7 +245,7 @@ export default function Canvas({ imageUrl, imageName }: { imageUrl: string, imag
|
|
245 |
const getLabels = async () => {
|
246 |
clearLayers();
|
247 |
try {
|
248 |
-
const res = await axios.get(
|
249 |
classOptionsRef.current = [...new Set(res.data.labels)];
|
250 |
// add an initial group to start with
|
251 |
groupRef.current.push(new Konva.Group());
|
@@ -269,7 +269,7 @@ export default function Canvas({ imageUrl, imageName }: { imageUrl: string, imag
|
|
269 |
|
270 |
clearLayers();
|
271 |
try {
|
272 |
-
const res = await axios.post(
|
273 |
mask: mask,
|
274 |
label: classList[length - 1],
|
275 |
});
|
@@ -287,7 +287,7 @@ export default function Canvas({ imageUrl, imageName }: { imageUrl: string, imag
|
|
287 |
const getBboxes = async () => {
|
288 |
clearLayers();
|
289 |
try {
|
290 |
-
const res = await axios.get(
|
291 |
classOptionsRef.current = [...new Set(res.data.labels)];
|
292 |
groupRef.current.push(new Konva.Group());
|
293 |
for (let i = 0; i < res.data.bboxes.length; i++) {
|
|
|
171 |
pointsRef.current = points;
|
172 |
|
173 |
const res = await axios.post(
|
174 |
+
`v1/get_label_preds/${imageName}`,
|
175 |
{
|
176 |
points: points,
|
177 |
labels: labels,
|
|
|
230 |
masks.push(labelData);
|
231 |
}
|
232 |
|
233 |
+
const res = await axios.put(`v1/label_image/${imageName}`,
|
234 |
{
|
235 |
masks: masks,
|
236 |
labels: classList,
|
|
|
245 |
const getLabels = async () => {
|
246 |
clearLayers();
|
247 |
try {
|
248 |
+
const res = await axios.get(`v1/get_labels/${imageName}`);
|
249 |
classOptionsRef.current = [...new Set(res.data.labels)];
|
250 |
// add an initial group to start with
|
251 |
groupRef.current.push(new Konva.Group());
|
|
|
269 |
|
270 |
clearLayers();
|
271 |
try {
|
272 |
+
const res = await axios.post(`v1/get_multi_label_preds/${imageName}`, {
|
273 |
mask: mask,
|
274 |
label: classList[length - 1],
|
275 |
});
|
|
|
287 |
const getBboxes = async () => {
|
288 |
clearLayers();
|
289 |
try {
|
290 |
+
const res = await axios.get(`v1/get_labels/${imageName}`);
|
291 |
classOptionsRef.current = [...new Set(res.data.labels)];
|
292 |
groupRef.current.push(new Konva.Group());
|
293 |
for (let i = 0; i < res.data.bboxes.length; i++) {
|
instance-labeler/app/page.tsx
CHANGED
@@ -11,13 +11,13 @@ export default function Home() {
|
|
11 |
const [displayIndex, setDisplayIndex] = useState<number>(0);
|
12 |
|
13 |
const getAllImages = async () => {
|
14 |
-
const res = await axios.get(
|
15 |
setImages(res.data.images);
|
16 |
}
|
17 |
|
18 |
const setCurrentImage = async () => {
|
19 |
if (images[displayIndex] === undefined) return;
|
20 |
-
const res = await axios.get(
|
21 |
const contentType = res.headers['content-type'];
|
22 |
setDisplayImage(`data:${contentType};base64,${res.data}`);
|
23 |
}
|
@@ -26,7 +26,7 @@ export default function Home() {
|
|
26 |
const reader = new FileReader();
|
27 |
reader.addEventListener("load", async () => {
|
28 |
const newImageName = `img${images.length + 1}`;
|
29 |
-
const res = await axios.put(
|
30 |
{
|
31 |
image: reader.result,
|
32 |
}
|
|
|
11 |
const [displayIndex, setDisplayIndex] = useState<number>(0);
|
12 |
|
13 |
const getAllImages = async () => {
|
14 |
+
const res = await axios.get(`v1/get_all_images`);
|
15 |
setImages(res.data.images);
|
16 |
}
|
17 |
|
18 |
const setCurrentImage = async () => {
|
19 |
if (images[displayIndex] === undefined) return;
|
20 |
+
const res = await axios.get(`v1/get_image/${images[displayIndex]}`);
|
21 |
const contentType = res.headers['content-type'];
|
22 |
setDisplayImage(`data:${contentType};base64,${res.data}`);
|
23 |
}
|
|
|
26 |
const reader = new FileReader();
|
27 |
reader.addEventListener("load", async () => {
|
28 |
const newImageName = `img${images.length + 1}`;
|
29 |
+
const res = await axios.put(`v1/upload_image/${newImageName}`,
|
30 |
{
|
31 |
image: reader.result,
|
32 |
}
|