Skip to content

Commit

Permalink
factor out api url
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchang committed Nov 4, 2024
1 parent fe808d7 commit 98a0897
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { ImageToTextArgs, ImageToTextResponse, AlignImageArgs, AlignImageResponse } from "./types/types";

const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:8000/"

export const AlignImage = async (args: AlignImageArgs): Promise<AlignImageResponse | null> => {
const { sourceImage, templateImage } = args;
const form = new URLSearchParams({
source_image: sourceImage,
segmentation_template: templateImage,
});

const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:8000/"
const alignImageURL = `${apiUrl}image_alignment/`
try {
const response = await fetch(alignImageURL, {
Expand All @@ -33,7 +34,6 @@ export const ImageToText = async (args: ImageToTextArgs): Promise<ImageToTextRes
labels: JSON.stringify(fieldNames),
});

const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:8000/"
const imageToTextURL = `${apiUrl}image_to_text/`
try {
const response = await fetch(imageToTextURL, {
Expand Down

0 comments on commit 98a0897

Please sign in to comment.