Skip to content

Commit

Permalink
update: api (#82)
Browse files Browse the repository at this point in the history
* update: api

* add: netlify.toml

* update: env
  • Loading branch information
Vincentqyw authored Oct 5, 2024
1 parent 13037f0 commit ea1ea65
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ gen_example.py
datasets/lines/terrace0.JPG
datasets/lines/terrace1.JPG
datasets/South-Building*
*.pkl
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y git-lfs
RUN git lfs install

# Clone the Git repository
RUN git clone https://huggingface.co/spaces/Realcat/image-matching-webui /code
RUN git clone --recursive https://github.com/Vincentqyw/image-matching-webui.git /code

RUN conda create -n imw python=${PYTHON_VERSION}
RUN echo "source activate imw" > ~/.bashrc
Expand Down
14 changes: 10 additions & 4 deletions api/client.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import os
import argparse
import pickle
import time
from typing import Dict

import numpy as np
import requests
from loguru import logger

API_URL_MATCH = "http://127.0.0.1:8001/v1/match"
API_URL_EXTRACT = "http://127.0.0.1:8001/v1/extract"
API_URL_EXTRACT_V2 = "http://127.0.0.1:8001/v2/extract"
URL = "http://127.0.0.1:8001"
if "REMOTE_URL_RAILWAY" in os.environ:
URL = os.environ["REMOTE_URL_RAILWAY"]

logger.info(f"API URL: {URL}")

API_URL_MATCH = f"{URL}/v1/match"
API_URL_EXTRACT = f"{URL}/v1/extract"
API_URL_EXTRACT_V2 = f"{URL}/v2/extract"


def send_generate_request(path0: str, path1: str) -> Dict[str, np.ndarray]:
Expand Down
15 changes: 15 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[build]
command = """
git clone --recursive https://github.com/Vincentqyw/image-matching-webui.git &&
pip install -r requirements.txt &&
python server.py
"""
publish = "."

[context.production.environment]
PYTHON_VERSION = "3.10"

[[redirects]]
from = "/*"
to = "/index.html"
status = 200
5 changes: 0 additions & 5 deletions package.json

This file was deleted.

14 changes: 0 additions & 14 deletions vercel.json

This file was deleted.

0 comments on commit ea1ea65

Please sign in to comment.