ritianyu commited on
Commit
c7af552
·
1 Parent(s): d72f369

fix bug in cuda init

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -5,12 +5,6 @@ import os
5
  from pathlib import Path
6
  from typing import Optional
7
 
8
- import cv2
9
- import gradio as gr
10
- import numpy as np
11
- import torch
12
- from huggingface_hub import hf_hub_download
13
-
14
 
15
  def _ensure_localhost_no_proxy() -> None:
16
  hosts = ["127.0.0.1", "localhost", "::1"]
@@ -28,6 +22,19 @@ def _ensure_localhost_no_proxy() -> None:
28
 
29
  _ensure_localhost_no_proxy()
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  from InfiniDepth.utils.hf_demo_utils import (
32
  DemoArtifacts,
33
  ensure_session_output_dir,
@@ -48,13 +55,6 @@ from InfiniDepth.utils.io_utils import depth_to_disparity
48
  from InfiniDepth.utils.model_utils import build_model
49
  from InfiniDepth.utils.sampling_utils import SAMPLING_METHODS
50
 
51
- try:
52
- import spaces
53
-
54
- GPU = spaces.GPU
55
- except ImportError:
56
- GPU = lambda fn: fn
57
-
58
 
59
  APP_ROOT = Path(__file__).resolve().parent
60
  EXAMPLES_DIR = APP_ROOT / "example_data"
 
5
  from pathlib import Path
6
  from typing import Optional
7
 
 
 
 
 
 
 
8
 
9
  def _ensure_localhost_no_proxy() -> None:
10
  hosts = ["127.0.0.1", "localhost", "::1"]
 
22
 
23
  _ensure_localhost_no_proxy()
24
 
25
+ try:
26
+ import spaces
27
+
28
+ GPU = spaces.GPU
29
+ except ImportError:
30
+ GPU = lambda fn: fn
31
+
32
+ import cv2
33
+ import gradio as gr
34
+ import numpy as np
35
+ import torch
36
+ from huggingface_hub import hf_hub_download
37
+
38
  from InfiniDepth.utils.hf_demo_utils import (
39
  DemoArtifacts,
40
  ensure_session_output_dir,
 
55
  from InfiniDepth.utils.model_utils import build_model
56
  from InfiniDepth.utils.sampling_utils import SAMPLING_METHODS
57
 
 
 
 
 
 
 
 
58
 
59
  APP_ROOT = Path(__file__).resolve().parent
60
  EXAMPLES_DIR = APP_ROOT / "example_data"