John6666 commited on
Commit
46cb9e2
1 Parent(s): c2de824

Update app.py

Browse files

I found out what gpu_initialisation() is for, so I resurrected it. This guy is **just a dummy function**.
In Zero GPU space, app.py or wherever, one function with @spaces decorator must be present or it will crash without question. That's probably why this guy was created.

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -123,7 +123,7 @@ async def health() -> JSONResponse:
123
  # try executingx gpu_initialization() not within infer_lisa_gradio()
124
  # gpu_initialization()
125
 
126
- @spaces.GPU
127
  def infer_lisa_gradio(request_input: StringPromptApiRequestBody) -> str:
128
  from samgis_lisa.io_package.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
129
  from samgis_lisa.prediction_api import lisa
@@ -143,7 +143,7 @@ def infer_lisa_gradio(request_input: StringPromptApiRequestBody) -> str:
143
  app_logger.debug(f"body_request:type(source):{type(source)}, source:{source}.")
144
  app_logger.debug(f"body_request:type(source_name):{type(source_name)}, source_name:{source_name}.")
145
  app_logger.debug(f"lisa module:{lisa}.")
146
- # gpu_initialization()
147
  output = lisa.lisa_predict(
148
  bbox=body_request["bbox"], prompt=body_request["prompt"], zoom=body_request["zoom"],
149
  source=source, source_name=source_name, inference_function_name_key=LISA_INFERENCE_FN,
 
123
  # try executingx gpu_initialization() not within infer_lisa_gradio()
124
  # gpu_initialization()
125
 
126
+ #@spaces.GPU
127
  def infer_lisa_gradio(request_input: StringPromptApiRequestBody) -> str:
128
  from samgis_lisa.io_package.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
129
  from samgis_lisa.prediction_api import lisa
 
143
  app_logger.debug(f"body_request:type(source):{type(source)}, source:{source}.")
144
  app_logger.debug(f"body_request:type(source_name):{type(source_name)}, source_name:{source_name}.")
145
  app_logger.debug(f"lisa module:{lisa}.")
146
+ gpu_initialization()
147
  output = lisa.lisa_predict(
148
  bbox=body_request["bbox"], prompt=body_request["prompt"], zoom=body_request["zoom"],
149
  source=source, source_name=source_name, inference_function_name_key=LISA_INFERENCE_FN,