jvamvas commited on
Commit
2bfc104
·
verified ·
1 Parent(s): 1a212f3

Add @spaces.GPU so ZeroGPU startup detection passes

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -3,6 +3,11 @@ from pathlib import Path
3
 
4
  sys.path.insert(0, str(Path(__file__).resolve().parent))
5
 
 
 
 
 
 
6
  from jinja2 import Environment
7
  import gradio as gr
8
 
@@ -18,6 +23,12 @@ from llm_query.utils import (
18
  )
19
 
20
 
 
 
 
 
 
 
21
  MODEL_NAME = "gpt-5.6-terra"
22
  AUX_SYNC_CONFIG_NAME = "config.v0.6.json"
23
  SPAN_MARKING_CONFIG_NAME = "config.span_marking.v0.6.json"
@@ -82,6 +93,7 @@ def empty_tooltips(tokens: tuple[str, ...]) -> tuple[str, ...]:
82
  return tuple("" for _ in tokens)
83
 
84
 
 
85
  def generate_diff(text_a: str, text_b: str):
86
  aux_client = get_aux_sync_client()
87
  marking_client = get_span_marking_client()
 
3
 
4
  sys.path.insert(0, str(Path(__file__).resolve().parent))
5
 
6
+ try:
7
+ import spaces
8
+ except ImportError:
9
+ spaces = None
10
+
11
  from jinja2 import Environment
12
  import gradio as gr
13
 
 
23
  )
24
 
25
 
26
+ def zero_gpu(duration: int = 120):
27
+ if spaces is None:
28
+ return lambda function: function
29
+ return spaces.GPU(duration=duration)
30
+
31
+
32
  MODEL_NAME = "gpt-5.6-terra"
33
  AUX_SYNC_CONFIG_NAME = "config.v0.6.json"
34
  SPAN_MARKING_CONFIG_NAME = "config.span_marking.v0.6.json"
 
93
  return tuple("" for _ in tokens)
94
 
95
 
96
+ @zero_gpu(duration=120)
97
  def generate_diff(text_a: str, text_b: str):
98
  aux_client = get_aux_sync_client()
99
  marking_client = get_span_marking_client()