Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,7 @@ model = AutoModel.from_pretrained(
|
|
103 |
|
104 |
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
|
105 |
# set the max number of tiles in `max_num`
|
106 |
-
pixel_values = load_image('./examples/
|
107 |
|
108 |
generation_config = dict(
|
109 |
num_beams=1,
|
@@ -126,8 +126,8 @@ response, history = model.chat(tokenizer, pixel_values, question, generation_con
|
|
126 |
print(question, response)
|
127 |
|
128 |
# multi-round multi-image conversation
|
129 |
-
pixel_values1 = load_image('./examples/
|
130 |
-
pixel_values2 = load_image('./examples/
|
131 |
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
|
132 |
|
133 |
question = "详细描述这两张图片" # Describe the two pictures in detail
|
@@ -139,8 +139,8 @@ response, history = model.chat(tokenizer, pixel_values, question, generation_con
|
|
139 |
print(question, response)
|
140 |
|
141 |
# batch inference (single image per sample)
|
142 |
-
pixel_values1 = load_image('./examples/
|
143 |
-
pixel_values2 = load_image('./examples/
|
144 |
image_counts = [pixel_values1.size(0), pixel_values2.size(0)]
|
145 |
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
|
146 |
|
|
|
103 |
|
104 |
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
|
105 |
# set the max number of tiles in `max_num`
|
106 |
+
pixel_values = load_image('./examples/Screenshot 2024-05-15 212157.png', max_num=6).to(torch.bfloat16).cuda()
|
107 |
|
108 |
generation_config = dict(
|
109 |
num_beams=1,
|
|
|
126 |
print(question, response)
|
127 |
|
128 |
# multi-round multi-image conversation
|
129 |
+
pixel_values1 = load_image('./examples/Screenshot 2024-05-15 212157.png', max_num=6).to(torch.bfloat16).cuda()
|
130 |
+
pixel_values2 = load_image('./examples/Screenshot 2024-05-15 222516.png', max_num=6).to(torch.bfloat16).cuda()
|
131 |
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
|
132 |
|
133 |
question = "详细描述这两张图片" # Describe the two pictures in detail
|
|
|
139 |
print(question, response)
|
140 |
|
141 |
# batch inference (single image per sample)
|
142 |
+
pixel_values1 = load_image('./examples/Screenshot 2024-05-15 212157.png', max_num=6).to(torch.bfloat16).cuda()
|
143 |
+
pixel_values2 = load_image('./examples/Screenshot 2024-05-15 222516.png', max_num=6).to(torch.bfloat16).cuda()
|
144 |
image_counts = [pixel_values1.size(0), pixel_values2.size(0)]
|
145 |
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
|
146 |
|