yuhangzang commited on
Commit
bfa0114
·
1 Parent(s): f67157b
app.py CHANGED
@@ -6,7 +6,7 @@ from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
6
 
7
  MODEL_ID = "internlm/CapRL-3B"
8
  DEFAULT_PROMPT = "Describe the image in detail."
9
- MAX_NEW_TOKENS = 1024
10
 
11
 
12
  def get_device() -> str:
@@ -124,13 +124,26 @@ with gr.Blocks(title="CapRL Image Captioning") as demo:
124
  outputs=[caption_output, token_output],
125
  )
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  gr.Markdown(
128
  """### Citation
129
  If you find this project useful, please kindly cite:
130
 
131
  ```
132
  @article{xing2025caprl,
133
- title={CapRL: Stimulating Dense Image Caption Capabilities via Reinforcement Learning},
134
  author={Xing, Long and Dong, Xiaoyi and Zang, Yuhang and Cao, Yuhang and Liang, Jianze and Huang, Qidong and Wang, Jiaqi and Wu, Feng and Lin, Dahua},
135
  journal={arXiv preprint arXiv:2509.22647},
136
  year={2025}
 
6
 
7
  MODEL_ID = "internlm/CapRL-3B"
8
  DEFAULT_PROMPT = "Describe the image in detail."
9
+ MAX_NEW_TOKENS = 4096
10
 
11
 
12
  def get_device() -> str:
 
124
  outputs=[caption_output, token_output],
125
  )
126
 
127
+ gr.Examples(
128
+ examples=[
129
+ ["./examples/example_chinese.png"],
130
+ ["./examples/example_receipt.jpg"],
131
+ ["./examples/example_table.png"],
132
+ ],
133
+ inputs=image_input,
134
+ outputs=[caption_output, token_output],
135
+ fn=generate_caption,
136
+ cache_examples=False,
137
+ label="📸 Example Images"
138
+ )
139
+
140
  gr.Markdown(
141
  """### Citation
142
  If you find this project useful, please kindly cite:
143
 
144
  ```
145
  @article{xing2025caprl,
146
+ title={{CapRL}: Stimulating Dense Image Caption Capabilities via Reinforcement Learning},
147
  author={Xing, Long and Dong, Xiaoyi and Zang, Yuhang and Cao, Yuhang and Liang, Jianze and Huang, Qidong and Wang, Jiaqi and Wu, Feng and Lin, Dahua},
148
  journal={arXiv preprint arXiv:2509.22647},
149
  year={2025}
examples/example_chinese.png ADDED
examples/example_receipt.jpg ADDED
examples/example_table.png ADDED