Fill-the-Frames / frontend /src /lib /api /interpolation-client.ts
sid385's picture
fix: Use production Hugging Face BASE_URL instead of localhost for interpolation
93b2652
Raw
History Blame Contribute Delete
1 kB
import { ApiResponse } from "@/types/api";
import { BASE_URL } from "./base-client";
export const interpolationClient = {
generateInterpolation: async (fileId1: string, fileId2: string, variable: string = "C13"): Promise<ApiResponse> => {
const formData = new FormData();
formData.append("file_id_1", fileId1);
formData.append("file_id_2", fileId2);
formData.append("variable", variable);
const response = await fetch(`${BASE_URL}/interpolation/generate`, {
method: "POST",
body: formData,
});
if (!response.ok) {
throw new Error(`Generation failed with status ${response.status}`);
}
return response.json();
},
getJobStatus: async (jobId: string): Promise<ApiResponse> => {
const response = await fetch(`${BASE_URL}/interpolation/status/${jobId}`, {
method: "GET",
});
if (!response.ok) {
throw new Error(`Failed to fetch job status with status ${response.status}`);
}
return response.json();
}
};