multimodalart HF Staff commited on
Commit
efb1aca
·
verified ·
1 Parent(s): 6105bdb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -57,7 +57,19 @@ EOS_TOKEN_ID = tokenizer.eos_token_id
57
  print("Model ready.", flush=True)
58
 
59
 
60
- @spaces.GPU(duration=90)
 
 
 
 
 
 
 
 
 
 
 
 
61
  def answer_question(
62
  image,
63
  question: str,
@@ -116,8 +128,10 @@ the native visual rows as fixed evidence. Only the final recurrent state reaches
116
  answer decoder — the original visual rows and multimodal prefix cache are cut off, which
117
  makes the latent visual reasoning *causally necessary* rather than merely present.
118
 
119
- Ask an open-ended question about an image, or use the benchmark-style multiple-choice
120
- format the model was tuned on. Decoding is deterministic (greedy) by design.
 
 
121
 
122
  [Paper](https://huggingface.co/papers/2609.06746) · [Code](https://github.com/dmis-lab/CVRR) · [Model](https://huggingface.co/dmis-lab/Qwen2.5-VL-7B-CVRR)
123
  """
@@ -149,7 +163,7 @@ with gr.Blocks() as demo:
149
  question_in = gr.Textbox(
150
  label="Question",
151
  lines=3,
152
- placeholder="What is the person on the left holding?",
153
  )
154
  run_btn = gr.Button("Answer", variant="primary")
155
  answer_out = gr.Textbox(label="Answer", lines=4)
 
57
  print("Model ready.", flush=True)
58
 
59
 
60
+ def _estimate_duration(
61
+ image=None, question=None, max_new_tokens=64, max_visual_tokens=4096, *args, **kwargs
62
+ ) -> int:
63
+ """ZeroGPU reservation: cold-start weight streaming plus input-dependent decode."""
64
+ try:
65
+ tokens = int(max_new_tokens)
66
+ visual = int(max_visual_tokens)
67
+ except (TypeError, ValueError):
68
+ tokens, visual = 64, 4096
69
+ return int(min(75, 22 + tokens * 0.045 + visual * 0.0015))
70
+
71
+
72
+ @spaces.GPU(duration=_estimate_duration)
73
  def answer_question(
74
  image,
75
  question: str,
 
128
  answer decoder — the original visual rows and multimodal prefix cache are cut off, which
129
  makes the latent visual reasoning *causally necessary* rather than merely present.
130
 
131
+ Ask a question about an image — open-ended, or in the benchmark-style multiple-choice
132
+ format the model was tuned on. Decoding is deterministic (greedy) by design. The recurrent
133
+ transition is supervised on short VQA answers, so crisp, targeted questions work best;
134
+ long free-form descriptions drift.
135
 
136
  [Paper](https://huggingface.co/papers/2609.06746) · [Code](https://github.com/dmis-lab/CVRR) · [Model](https://huggingface.co/dmis-lab/Qwen2.5-VL-7B-CVRR)
137
  """
 
163
  question_in = gr.Textbox(
164
  label="Question",
165
  lines=3,
166
+ placeholder="Is the peacock's tail open or closed?",
167
  )
168
  run_btn = gr.Button("Answer", variant="primary")
169
  answer_out = gr.Textbox(label="Answer", lines=4)