Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -63,8 +63,13 @@ def process_image(model, tokenizer, transform, device, check_type, image, text):
|
|
63 |
target_ratio = (1, 1)
|
64 |
|
65 |
# 文本处理
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
input_ids = torch.tensor(input_ids, device=device)
|
69 |
|
70 |
# 获取嵌入
|
|
|
63 |
target_ratio = (1, 1)
|
64 |
|
65 |
# 文本处理
|
66 |
+
text_input = text
|
67 |
+
|
68 |
+
if text_input[0] in '!"#$%&\'()*+,-./0123456789:;<=>?@^_{|}~0123456789':
|
69 |
+
input_ids = tokenizer(text_input)['input_ids'][1:]
|
70 |
+
else:
|
71 |
+
input_ids = tokenizer(' '+text_input)['input_ids'][1:]
|
72 |
+
|
73 |
input_ids = torch.tensor(input_ids, device=device)
|
74 |
|
75 |
# 获取嵌入
|