yuhangzang commited on
Commit
3ebc4f1
·
1 Parent(s): 74cb695

Update examples and defaults: replace example images with 1909.png, 44687.jpeg, natural.png; set default image to 1909.png; update default caption and token count to 826

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ examples/natural.png filter=lfs diff=lfs merge=lfs -text
37
+ examples/*.png filter=lfs diff=lfs merge=lfs -text
38
+ examples/*.jpg filter=lfs diff=lfs merge=lfs -text
39
+ examples/*.jpeg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -8,50 +8,95 @@ DEFAULT_PROMPT = "Describe the image in detail."
8
  MAX_NEW_TOKENS = 4096
9
 
10
  # Defaults for UI
11
- DEFAULT_IMAGE_PATH = "./examples/example_chinese.png"
12
- DEFAULT_CAPTION = """The image depicts a text excerpt, likely from an ancient or classical Chinese document, written in traditional script. Here is a detailed description:
13
-
14
- ---
15
-
16
- **Image Description:**
17
-
18
- The image shows a page from what appears to be a historical or literary text, specifically related to ancient Chinese poetry or prose. The text is titled "序" (preface), indicating it's an introductory section. The content is structured as follows:
19
-
20
- 1. **Header and Title:**
21
- - The top line reads "古人云五百年萬六千日何況人生不閨雅佳" which translates to "Ancient people say that even five hundred years and six thousand days are nothing compared to life, not to mention being unreservedly beautiful."
22
-
23
- 2. **Main Text Content:**
24
- - The passage begins with "詎醒世之人萬六千日謂生人一事無成" suggesting a reflection on the fleeting nature of life over a vast period.
25
-
26
- 3. **Key Phrases and Names:
27
- - "過道還書身易張日夕思慕最凡在秋神冷" refers to someone who frequently thinks about books and autumn, possibly a scholar or writer.
28
-
29
- 4. **Detailed Descriptions:
30
- - "道士六魌急力問夢至春田處於筆頭翻得詩" describes a道士在六个地狱中匆忙询问梦境,最终在春天的田野处从笔下翻出诗句。 This indicates a dream or mystical experience leading to poetic inspiration.
31
-
32
- 5. **Cultural References:
33
- - "曲數本其間四時風景幽蘭處蜘蛛繚繞之思應如知" mentions counting the four seasons and the beauty of幽兰,with spiders weaving around, suggesting a vivid, natural scene.
34
-
35
- 6. **Time and Weather:
36
- - "在日前不眠眼中多釃精橋琥珀色忘冰奚與異" indicates someone who was awake all night, observing and noting the color of a bridge made of精 (possibly a type of stone or material) and ice, perhaps reflecting on a specific moment or event.
37
-
38
- 7. **Emotional and Personal Touch:
39
- - "悉心之樂不禁語話諸兄以初意手" expresses deep personal joy and initial intentions, likely referring to a heartfelt message or letter from someone named "初意手."
40
-
41
- 8. **Additional Notes:
42
- - "錄載曰亦自作不由得清退法這法後合因人省" suggests that the text is a record of someone's own writing, perhaps a self-reflection or diary entry, mentioning a need for self-retirement or withdrawal from certain matters.
43
-
44
- 9. **Numerical References:
45
- - "萬人云五百年" emphasizes the vastness of time, stating five hundred years.
46
-
47
- 10. **Characters Mentioned:**
48
- - The text mentions "鍾戴" (Zhòng dài), likely a person or place name, who is described as not leaving at a certain time, implying they were engaged in some activity until late.
49
-
50
- 11. **Visual Elements:**
51
- - The text is written in traditional Chinese characters, with a formal and classical style typical of ancient literary works.
52
-
53
- This detailed description should provide a pure text model with sufficient context to answer any related questions about the image."""
54
- DEFAULT_TOKENS = 674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
 
57
  def load_model():
@@ -195,9 +240,9 @@ caprl (GPU Space)
195
 
196
  gr.Examples(
197
  examples=[
198
- ["./examples/example_chinese.png", MAX_NEW_TOKENS],
199
- ["./examples/example_receipt.jpg", MAX_NEW_TOKENS],
200
- ["./examples/example_table.png", MAX_NEW_TOKENS],
201
  ],
202
  inputs=[image_input, max_new_tokens_slider],
203
  outputs=[caption_output, token_output],
 
8
  MAX_NEW_TOKENS = 4096
9
 
10
  # Defaults for UI
11
+ DEFAULT_IMAGE_PATH = "./examples/1909.png"
12
+ DEFAULT_CAPTION = """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.
13
+
14
+ ### Title:
15
+ Older Republicans especially likely to see Trump as fighting for their beliefs
16
+
17
+ ### Main Question:
18
+ Among Republicans and Republican leaners, % who say the phrase 'fights for what I believe in' describes Trump ...
19
+
20
+ ### Data Breakdown:
21
+
22
+ 1. **All Rep/Lean Rep (Overall):**
23
+ - Very well: 51%
24
+ - Fairly well: 36%
25
+ - NET: 87%
26
+
27
+ 2. **Ages 18-29:**
28
+ - Very well: 31%
29
+ - Fairly well: 45%
30
+ - NET: 76%
31
+
32
+ 3. **30-49:**
33
+ - Very well: 41%
34
+ - Fairly well: 42%
35
+ - NET: 82%
36
+
37
+ 4. **50-64:**
38
+ - Very well: 58%
39
+ - Fairly well: 33%
40
+ - NET: 92%
41
+
42
+ 5. **65+:**
43
+ - Very well: 68%
44
+ - Fairly well: 26%
45
+ - NET: 94%
46
+
47
+ 6. **Postgrad:**
48
+ - Very well: 42%
49
+ - Fairly well: 38%
50
+ - NET: 80%
51
+
52
+ 7. **College grad:**
53
+ - Very well: 45%
54
+ - Fairly well: 40%
55
+ - NET: 85%
56
+
57
+ 8. **Some college:**
58
+ - Very well: 51%
59
+ - Fairly well: 36%
60
+ - NET: 87%
61
+
62
+ 9. **HS or less:**
63
+ - Very well: 56%
64
+ - Fairly well: 33%
65
+ - NET: 89
66
+
67
+ 10. **Conserv (Conservative):**
68
+ - Very well: 63%
69
+ - Fairly well: 31%
70
+ - NET: 94%
71
+
72
+ 11. **Mod/Lib (Moderate/Liberal):**
73
+ - Very well: 32%
74
+ - Fairly well: 44%
75
+ - NET: 75
76
+
77
+ 12. **Republican:**
78
+ - Very well: 61%
79
+ - Fairly well: 32%
80
+ - NET: 93
81
+
82
+ 13. **Lean Republican:**
83
+ - Very well: 36%
84
+ - Fairly well: 41%
85
+ - NET: 77
86
+
87
+ ### Notes:
88
+ - The note at the bottom states that the data is based on Republicans and Republican-leaning independents.
89
+ - The source is a survey of U.S. adults conducted from February 4-15, 2020.
90
+
91
+ ### Key Observations:
92
+ 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.
93
+ 2. Younger age groups (18-29) have the lowest net positive percentage at 76.
94
+ 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).
95
+ 4. Conservatives (63% very well) are the most likely to see Trump this way, followed by Republicans (61%).
96
+ 5. Lean Republicans (36% very well) have the lowest percentage among the leaner categories.
97
+
98
+ This detailed description should provide a pure text model with sufficient information to answer any related questions about the image."""
99
+ DEFAULT_TOKENS = 826
100
 
101
 
102
  def load_model():
 
240
 
241
  gr.Examples(
242
  examples=[
243
+ ["./examples/1909.png", MAX_NEW_TOKENS],
244
+ ["./examples/44687.jpeg", MAX_NEW_TOKENS],
245
+ ["./examples/natural.png", MAX_NEW_TOKENS],
246
  ],
247
  inputs=[image_input, max_new_tokens_slider],
248
  outputs=[caption_output, token_output],
examples/1909.png ADDED

Git LFS Details

  • SHA256: 54ddd8eb81ae84c52add25beca7c5ea9b74d895fe440b64b776b87867765d27a
  • Pointer size: 131 Bytes
  • Size of remote file: 207 kB
examples/44687.jpeg ADDED

Git LFS Details

  • SHA256: 138d38df0fa796ec6e8788792d513e02618a8b853acfb61456f49b9397a44128
  • Pointer size: 131 Bytes
  • Size of remote file: 291 kB
examples/example_chinese.png DELETED
Binary file (17.3 kB)
 
examples/example_receipt.jpg DELETED
Binary file (66.7 kB)
 
examples/example_table.png DELETED
Binary file (19 kB)
 
examples/natural.png ADDED

Git LFS Details

  • SHA256: ac53f860f38dc2cbaf178c9679a60b2cd443393ed97a4dd8ea49dcfd131ff53e
  • Pointer size: 133 Bytes
  • Size of remote file: 15.5 MB