multimodalart HF Staff commited on
Commit
6d8527c
·
verified ·
1 Parent(s): 93a049b

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -99,7 +99,14 @@ def _render(qs, answers):
99
  return "<div class='ive-wrap'>" + "".join(cards) + "</div>"
100
 
101
 
102
- @spaces.GPU(duration=20)
 
 
 
 
 
 
 
103
  def decide(state: str, questions: str, images: list | None = None):
104
  """Answer typed decision questions about a state with calibrated probabilities (IVE-4B).
105
 
 
99
  return "<div class='ive-wrap'>" + "".join(cards) + "</div>"
100
 
101
 
102
+ def _gpu_duration(state, questions, images=None, *args, **kwargs):
103
+ """Measured on ZeroGPU: text ~0.1-0.3 s; one ~2 MP page ~1 s warm, ~9 s on the first
104
+ (kernel-compiling) call. Budget per image for cold kernel compilation."""
105
+ n = len(_image_paths(images)[:MAX_IMAGES])
106
+ return 8 if n == 0 else min(30, 8 + 4 * n)
107
+
108
+
109
+ @spaces.GPU(duration=_gpu_duration)
110
  def decide(state: str, questions: str, images: list | None = None):
111
  """Answer typed decision questions about a state with calibrated probabilities (IVE-4B).
112