himipo commited on
Commit
d962f04
·
verified ·
1 Parent(s): 78f1e89

Deploy OCR Model Workbench

Browse files
Files changed (2) hide show
  1. app.py +16 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -27,6 +27,22 @@ ABSOLUTE_MAX_PAGES = int(os.getenv("ABSOLUTE_MAX_PAGES", "40"))
27
  STALE_RUN_HOURS = float(os.getenv("STALE_RUN_HOURS", "12"))
28
 
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  def _spec(model_id: str) -> ModelSpec:
31
  try:
32
  return REGISTRY[model_id]
 
27
  STALE_RUN_HOURS = float(os.getenv("STALE_RUN_HOURS", "12"))
28
 
29
 
30
+ try:
31
+ import spaces
32
+ except Exception:
33
+ spaces = None
34
+
35
+
36
+ def _gateway_probe() -> str:
37
+ return "ready"
38
+
39
+
40
+ if spaces is not None:
41
+ gateway_zero_gpu_probe = spaces.GPU(duration=1)(_gateway_probe)
42
+ else:
43
+ gateway_zero_gpu_probe = _gateway_probe
44
+
45
+
46
  def _spec(model_id: str) -> ModelSpec:
47
  try:
48
  return REGISTRY[model_id]
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  gradio>=5.49.1,<7.0
2
  gradio_client>=2.3.0,<3.0
 
3
  httpx==0.28.1
4
  PyMuPDF==1.27.2.2
5
  Pillow==12.1.1
 
1
  gradio>=5.49.1,<7.0
2
  gradio_client>=2.3.0,<3.0
3
+ spaces>=0.40.0,<1.0
4
  httpx==0.28.1
5
  PyMuPDF==1.27.2.2
6
  Pillow==12.1.1