Spaces:
Runtime error
Runtime error
seanbenhur
commited on
Commit
•
a94eec7
1
Parent(s):
5f76d85
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def predict(image, max_length=64, num_beams=4):
|
|
22 |
pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values
|
23 |
pixel_values = pixel_values.to(device)
|
24 |
with torch.no_grad():
|
25 |
-
text = model.generate(pixel_values.unsqueeze(0).
|
26 |
text = tokenizer.decode(text.replace('<|endoftext|>', '').split('\n')[0],'\n\n\n')
|
27 |
# output_ids = model.generate(
|
28 |
# pixel_values,
|
|
|
22 |
pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values
|
23 |
pixel_values = pixel_values.to(device)
|
24 |
with torch.no_grad():
|
25 |
+
text = model.generate(pixel_values.unsqueeze(0).cpu())
|
26 |
text = tokenizer.decode(text.replace('<|endoftext|>', '').split('\n')[0],'\n\n\n')
|
27 |
# output_ids = model.generate(
|
28 |
# pixel_values,
|