yuhangzang commited on
Commit
19f4b38
Β·
1 Parent(s): f42ad7c

Update descriptions and default caption

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +77 -77
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: CapRL-Qwen3VL-4B
3
  emoji: 🎨
4
  colorFrom: blue
5
  colorTo: purple
@@ -8,6 +8,7 @@ sdk_version: 5.49.1
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
11
  ---
12
 
13
  # CapRL-Qwen3VL-4B Image Captioning
 
1
  ---
2
+ title: CapRL-Qwen3VL-4B for Image Captioning
3
  emoji: 🎨
4
  colorFrom: blue
5
  colorTo: purple
 
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
+ short_description: Generate captions for images with CapRL-Qwen3VL-4B
12
  ---
13
 
14
  # CapRL-Qwen3VL-4B Image Captioning
app.py CHANGED
@@ -10,77 +10,61 @@ MAX_NEW_TOKENS = 4096
10
 
11
  # Default demo content
12
  DEFAULT_IMAGE = "./examples/1909.png"
13
- DEFAULT_CAPTION = (
14
- "The image is a bar chart from the Pew Research Center that illustrates how older Republicans and Republican leaners view Donald Trump, specifically focusing on how many describe the phrase \"fights for what I believe in\" to describe Trump. The data is based on a survey conducted from February 4-15, 2020, among U.S. adults who identify as Republicans or Republican-leaning independents.\n\n"
15
- "### Title:\n"
16
- "Older Republicans especially likely to see Trump as fighting for their beliefs\n\n"
17
- "### Main Question:\n"
18
- "Among Republicans and Republican leaners, % who say the phrase 'fights for what I believe in' describes Trump ...\n\n"
19
- "### Data Breakdown:\n\n"
20
- "1. **All Rep/Lean Rep (Overall):**\n"
21
- " - Very well: 51%\n"
22
- " - Fairly well: 36%\n"
23
- " - NET: 87%\n\n"
24
- "2. **Ages 18-29:**\n"
25
- " - Very well: 31%\n"
26
- " - Fairly well: 45%\n"
27
- " - NET: 76%\n\n"
28
- "3. **30-49:**\n"
29
- " - Very well: 41%\n"
30
- " - Fairly well: 42%\n"
31
- " - NET: 82%\n\n"
32
- "4. **50-64:**\n"
33
- " - Very well: 58%\n"
34
- " - Fairly well: 33%\n"
35
- " - NET: 92%\n\n"
36
- "5. **65+:**\n"
37
- " - Very well: 68%\n"
38
- " - Fairly well: 26%\n"
39
- " - NET: 94%\n\n"
40
- "6. **Postgrad:**\n"
41
- " - Very well: 42%\n"
42
- " - Fairly well: 38%\n"
43
- " - NET: 80%\n\n"
44
- "7. **College grad:**\n"
45
- " - Very well: 45%\n"
46
- " - Fairly well: 40%\n"
47
- " - NET: 85%\n\n"
48
- "8. **Some college:**\n"
49
- " - Very well: 51%\n"
50
- " - Fairly well: 36%\n"
51
- " - NET: 87%\n\n"
52
- "9. **HS or less:**\n"
53
- " - Very well: 56%\n"
54
- " - Fairly well: 33%\n"
55
- " - NET: 89\n\n"
56
- "10. **Conserv (Conservative):**\n"
57
- " - Very well: 63%\n"
58
- " - Fairly well: 31%\n"
59
- " - NET: 94%\n\n"
60
- "11. **Mod/Lib (Moderate/Liberal):**\n"
61
- " - Very well: 32%\n"
62
- " - Fairly well: 44%\n"
63
- " - NET: 75\n\n"
64
- "12. **Republican:**\n"
65
- " - Very well: 61%\n"
66
- " - Fairly well: 32%\n"
67
- " - NET: 93\n\n"
68
- "13. **Lean Republican:**\n"
69
- " - Very well: 36%\n"
70
- " - Fairly well: 41%\n"
71
- " - NET: 77\n\n"
72
- "### Notes:\n"
73
- "- The note at the bottom states that the data is based on Republicans and Republican-leaning independents.\n"
74
- "- The source is a survey of U.S. adults conducted from February 4-15, 2020.\n\n"
75
- "### Key Observations:\n"
76
- "1. Older Republicans (65+) are the most likely to see Trump as someone who \"fights for what I believe in,\" with a net positive percentage of 94.\n"
77
- "2. Younger age groups (18-29) have the lowest net positive percentage at 76.\n"
78
- "3. Those with higher educational backgrounds (postgrad and college grad) have slightly lower net positive percentages compared to those with some college education (80 vs. 85).\n"
79
- "4. Conservatives (63% very well) are the most likely to see Trump this way, followed by Republicans (61%).\n"
80
- "5. Lean Republicans (36% very well) have the lowest percentage among the leaner categories.\n\n"
81
- "This detailed description should provide a pure text model with sufficient information to answer any related questions about the image."
82
- )
83
- DEFAULT_CAPTION_TOKENS = 826
84
 
85
 
86
  def get_device() -> str:
@@ -181,15 +165,31 @@ def generate_caption(image: Image.Image):
181
 
182
 
183
  with gr.Blocks(title="CapRL-Qwen3VL-4B Image Captioning") as demo:
184
- gr.Markdown("# CapRL-Qwen3VL-4B for Image Captioning")
185
- gr.Markdown("### CapRL: Stimulating Dense Image Caption Capabilities via Reinforcement Learning")
186
- gr.Markdown("Upload an image to generate a detailed caption with CapRL-Qwen3VL-4B!")
187
  gr.Markdown(
188
  """
189
- <a href="https://arxiv.org/abs/2509.22647">Paper</a> | <a href="https://github.com/InternLM/CapRL">Github</a> | <a href="https://huggingface.co/internlm/CapRL-Qwen3VL-4B">CapRL-Qwen3VL-4B Model</a> | <a href="https://huggingface.co/internlm/CapRL-3B">CapRL-3B Model</a> |
190
- <a href="https://huggingface.co/datasets/internlm/CapRL-2M">CapRL-2M Dataset</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
- <a href="https://huggingface.co/collections/long-xing1/caprl-68d64ac32ded31596c36e189">CapRL Collection</a> | <a href="https://huggingface.co/papers/2509.22647">Daily Paper</a>
193
  """
194
  )
195
 
 
10
 
11
  # Default demo content
12
  DEFAULT_IMAGE = "./examples/1909.png"
13
+ DEFAULT_CAPTION = """Based on the provided bar chart from the Pew Research Center, here is a detailed description:
14
+
15
+ **Title:** Older Republicans especially likely to see Trump as fighting for their beliefs
16
+ **Subtitle:** Among Republicans and Republican leaners, % who say the phrase 'fights for what I believe in' describes Trump ...
17
+
18
+ **Source:** Survey of U.S. adults conducted Feb. 4-15, 2020.
19
+
20
+ **Legend:**
21
+ - **Very well:** 51% (All Rep/Lean Rep)
22
+ - **Fairly well:** 36% (All Rep/Lean Rep)
23
+ - **NET:** Sum of "Very well" and "Fairly well"
24
+
25
+ **Data Summary:**
26
+
27
+ **All Rep/Lean Rep:**
28
+ - Very well: 51%
29
+ - Fairly well: 36%
30
+ - NET: 87%
31
+
32
+ **By Age:**
33
+ - Ages 18-29: Very well 31%, Fairly well 45%, NET 76%
34
+ - 30-49: Very well 41%, Fairly well 42%, NET 82%
35
+ - 50-64: Very well 58%, Fairly well 33%, NET 92%
36
+ - 65+: Very well 68%, Fairly well 26%, NET 94%
37
+
38
+ **By Education:**
39
+ - Postgrad: Very well 42%, Fairly well 38%, NET 80%
40
+ - College grad: Very well 45%, Fairly well 40%, NET 85%
41
+ - Some college: Very well 51%, Fairly well 36%, NET 87%
42
+ - HS or less: Very well 56%, Fairly well 33%, NET 89%
43
+
44
+ **By Conservatism:**
45
+ - Conserv: Very well 63%, Fairly well 31%, NET 94%
46
+ - Mod/Lib: Very well 32%, Fairly well 44%, NET 75%
47
+
48
+ **By Party Identification:**
49
+ - Republican: Very well 61%, Fairly well 32%, NET 93%
50
+ - Lean Republican: Very well 36%, Fairly well 41%, NET 77%
51
+
52
+ **Analysis:**
53
+
54
+ - The overall percentage of Republicans and Republican leaners who say Trump "fights for what I believe in" is 87% (51% "very well" and 36% "fairly well").
55
+ - The group most likely to say this is those aged 65 and older (94% NET), followed by those 50-64 (92% NET) and those with a high school diploma or less (89% NET).
56
+ - The youngest group (18-29) is the least likely (76% NET).
57
+ - Among education levels, those with a high school diploma or less are most likely (89% NET), followed by some college (87%) and college graduates (85%).
58
+ - The most conservative group (Conservative) is the most likely to say this (94% NET), while the moderate/liberal group is the least likely (75% NET).
59
+ - Among party identifiers, Republicans are most likely (93% NET), while lean Republicans are less likely (77% NET).
60
+ - The 65+ age group is also the most conservative (94% NET) and the most likely to say Trump fights for their beliefs.
61
+ - The 65+ group is also the most likely to say it "very well" (68%) and the least likely to say it "fairly well" (26%).
62
+ - The most conservative group (63% "very well") is also the most likely overall (94% NET), while the most moderate/liberal group (32% "very well") is the least likely (75% NET).
63
+ - The Republican party has a 93% NET, while the lean Republican group has a 77% NET.
64
+
65
+ **Conclusion:**
66
+ The chart shows that older Republicans (65+) are the most likely to see Trump as fighting for their beliefs, with 94% saying it "very well" or "fairly well." This is followed by those aged 50-64 (92%) and those with a high school diploma or less (89%). The most conservative Republicans are also the most likely (94%), while moderate/liberal Republicans are the least likely (75%). The youngest group (18-29) is the least likely (76%)."""
67
+ DEFAULT_CAPTION_TOKENS = 993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
 
70
  def get_device() -> str:
 
165
 
166
 
167
  with gr.Blocks(title="CapRL-Qwen3VL-4B Image Captioning") as demo:
 
 
 
168
  gr.Markdown(
169
  """
170
+ # CapRL
171
+ πŸ“–<a href="https://arxiv.org/abs/2509.22647">Paper</a> | 🏠<a href="https://github.com/InternLM/CapRL">Github</a> | πŸ€—<a href="https://huggingface.co/collections/long-xing1/caprl-68d64ac32ded31596c36e189">CapRL Collection</a> | πŸ€—<a href="https://huggingface.co/papers/2509.22647">Daily Paper</a>
172
+
173
+ ### CapRL Series Model & Dataset
174
+ | Series | Models & Resources |
175
+ | :--- | :--- |
176
+ | **CapRL 2.0 Series** | [πŸ€— CapRL-Qwen3VL-2B](https://huggingface.co/internlm/CapRL-Qwen3VL-2B) \| [πŸ€— CapRL-Qwen3VL-4B](https://huggingface.co/internlm/CapRL-Qwen3VL-4B) |
177
+ | **CapRL 1.0 Series** | [πŸ€— CapRL-Qwen2.5VL-3B](https://huggingface.co/internlm/CapRL-3B) \| [πŸ€— CapRL-InternVL3.5-8B](https://huggingface.co/yuhangzang/CapRL-InternVL3.5-8B) \| [πŸ“Š CapRL-2M Dataset](https://huggingface.co/datasets/internlm/CapRL-2M) \| [πŸ“¦ CapRL-3B-GGUF](https://huggingface.co/mradermacher/CapRL-3B-GGUF) \| [πŸ“¦ CapRL-3B-i1-GGUF](https://huggingface.co/mradermacher/CapRL-3B-i1-GGUF) |
178
+
179
+ ### CapRL-Qwen3VL-4B
180
+ We are excited to release the **CapRL 2.0 series**: **CapRL-Qwen3VL-2B** and **CapRL-Qwen3VL-4B**. These models feature fewer parameters while delivering even more powerful captioning performance.
181
+ Notably, **CapRL-Qwen3VL-2B outperforms both CapRL-Qwen2.5VL-3B and Qwen2.5VL-72B in captioning tasks**.
182
+ This leap in efficiency is driven by our upgraded training recipe, which includes a more rigorous QA data filter and a significantly more diverse image dataset. We welcome everyone to try them out!
183
+
184
+
185
+ When selecting between the available CapRL models, it's essential to consider the trade-off between performance and computational cost.
186
+ This guide will help you choose the most suitable model for your specific needs:
187
+ |Model|Parameters|Strength|
188
+ |-|-|-|
189
+ |πŸ€—[CapRL-Qwen3VL-2B](https://huggingface.co/internlm/CapRL-Qwen3VL-2B)|2B|Speed, Efficiency|
190
+ |πŸ€—[CapRL-Qwen3VL-4B](https://huggingface.co/internlm/CapRL-Qwen3VL-4B)|4B|High Performance, Advanced Captioning Ability|
191
 
192
+ **This Space** is based on **CapRL-Qwen3VL-4B**. You can also try out **CapRL-Qwen2.5VL-3B** 🎨&nbsp;&nbsp;&nbsp;&nbsp;➑️&nbsp;&nbsp;&nbsp;&nbsp;[🌈CapRL-Qwen2.5VL-3B Space](https://huggingface.co/spaces/yuhangzang/caprl)
193
  """
194
  )
195