Spaces:
Sleeping
Sleeping
João Pedro
commited on
Commit
·
99700b8
1
Parent(s):
5639711
truncate long text sequences
Browse files
app.py
CHANGED
@@ -25,7 +25,12 @@ if uploaded_file:
|
|
25 |
for i, image in enumerate(images):
|
26 |
st.image(image, caption=f'Uploaded Image {i}', use_container_width=True)
|
27 |
# Prepare image for model input
|
28 |
-
encoding = processor(
|
|
|
|
|
|
|
|
|
|
|
29 |
st.text(f'encoding: {encoding}')
|
30 |
outputs = model(**encoding)
|
31 |
predictions = outputs.logits.argmax(-1)
|
|
|
25 |
for i, image in enumerate(images):
|
26 |
st.image(image, caption=f'Uploaded Image {i}', use_container_width=True)
|
27 |
# Prepare image for model input
|
28 |
+
encoding = processor(
|
29 |
+
image,
|
30 |
+
return_tensors="pt",
|
31 |
+
truncation=True,
|
32 |
+
max_length=512,
|
33 |
+
)
|
34 |
st.text(f'encoding: {encoding}')
|
35 |
outputs = model(**encoding)
|
36 |
predictions = outputs.logits.argmax(-1)
|