SatQuery Deployer commited on
Commit
c193943
·
1 Parent(s): 89dc540

Deploy SatQuery EarthMind-4B Multimodal Service

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -30,8 +30,11 @@ logger = logging.getLogger("satquery.earthmind")
30
 
31
  try:
32
  import spaces
 
33
  has_spaces = True
34
- except ImportError:
 
 
35
  has_spaces = False
36
 
37
  MODEL_ID = os.getenv("MODEL_ID", "sy1998/EarthMind-4B")
@@ -155,6 +158,7 @@ def mask_to_base64_png(mask_array: np.ndarray) -> Optional[str]:
155
  return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode("ascii")
156
 
157
 
 
158
  def _run_earthmind_inference(
159
  image: Optional[Image.Image],
160
  query: str,
 
30
 
31
  try:
32
  import spaces
33
+ gpu_decorator = spaces.GPU(duration=60)
34
  has_spaces = True
35
+ except Exception:
36
+ def gpu_decorator(fn):
37
+ return fn
38
  has_spaces = False
39
 
40
  MODEL_ID = os.getenv("MODEL_ID", "sy1998/EarthMind-4B")
 
158
  return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode("ascii")
159
 
160
 
161
+ @gpu_decorator
162
  def _run_earthmind_inference(
163
  image: Optional[Image.Image],
164
  query: str,