Realcat commited on
Commit
fae4b17
·
1 Parent(s): 7352857

fix: using zerogpu

Browse files
Files changed (2) hide show
  1. app.py +1 -8
  2. imcui/ui/utils.py +4 -1
app.py CHANGED
@@ -1,11 +1,8 @@
1
  import argparse
2
  from pathlib import Path
3
- import spaces
4
  from imcui.ui.app_class import ImageMatchingApp
5
 
6
-
7
- @spaces.GPU(duration=60)
8
- def launch_app():
9
  parser = argparse.ArgumentParser()
10
  parser.add_argument(
11
  "--server_name",
@@ -32,7 +29,3 @@ def launch_app():
32
  config=args.config,
33
  example_data_root=Path("imcui/datasets"),
34
  ).run()
35
-
36
-
37
- if __name__ == "__main__":
38
- launch_app()
 
1
  import argparse
2
  from pathlib import Path
 
3
  from imcui.ui.app_class import ImageMatchingApp
4
 
5
+ if __name__ == "__main__":
 
 
6
  parser = argparse.ArgumentParser()
7
  parser.add_argument(
8
  "--server_name",
 
29
  config=args.config,
30
  example_data_root=Path("imcui/datasets"),
31
  ).run()
 
 
 
 
imcui/ui/utils.py CHANGED
@@ -7,6 +7,7 @@ from itertools import combinations
7
  from pathlib import Path
8
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
9
  from datasets import load_dataset
 
10
 
11
  import cv2
12
  import gradio as gr
@@ -48,7 +49,7 @@ GRADIO_VERSION = gr.__version__.split(".")[0]
48
  MATCHER_ZOO = None
49
 
50
 
51
- model_cache = ModelCache(max_gpu_mem = 48e9, max_cpu_mem=48e9)
52
 
53
 
54
  def load_config(config_name: str) -> Dict[str, Any]:
@@ -150,6 +151,7 @@ def download_example_images(repo_id, output_dir):
150
  logger.info(f"Images saved to {output_dir} successfully.")
151
  return Path(output_dir)
152
 
 
153
  def gen_examples(data_root: Path):
154
  random.seed(1)
155
  example_algos = [
@@ -826,6 +828,7 @@ def generate_fake_outputs(
826
  )
827
 
828
 
 
829
  def run_matching(
830
  image0: np.ndarray,
831
  image1: np.ndarray,
 
7
  from pathlib import Path
8
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
9
  from datasets import load_dataset
10
+ import spaces
11
 
12
  import cv2
13
  import gradio as gr
 
49
  MATCHER_ZOO = None
50
 
51
 
52
+ model_cache = ModelCache(max_gpu_mem=48e9, max_cpu_mem=48e9)
53
 
54
 
55
  def load_config(config_name: str) -> Dict[str, Any]:
 
151
  logger.info(f"Images saved to {output_dir} successfully.")
152
  return Path(output_dir)
153
 
154
+
155
  def gen_examples(data_root: Path):
156
  random.seed(1)
157
  example_algos = [
 
828
  )
829
 
830
 
831
+ @spaces.GPU(duration=60)
832
  def run_matching(
833
  image0: np.ndarray,
834
  image1: np.ndarray,