Spaces:
Runtime error
Runtime error
sunny-annie
commited on
Commit
·
c605fcd
1
Parent(s):
6707879
Update app.py
Browse files
app.py
CHANGED
@@ -33,9 +33,10 @@ if uploaded_file is not None:
|
|
33 |
if image.mode != "RGB":
|
34 |
image = image.convert(mode="RGB")
|
35 |
|
36 |
-
|
37 |
-
pixel_values = pixel_values.to(device)
|
38 |
if button:
|
|
|
|
|
39 |
output_ids = model.generate(pixel_values, **gen_kwargs)
|
40 |
preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
41 |
preds = [pred.strip() for pred in preds]
|
|
|
33 |
if image.mode != "RGB":
|
34 |
image = image.convert(mode="RGB")
|
35 |
|
36 |
+
|
|
|
37 |
if button:
|
38 |
+
pixel_values = feature_extractor(images=[image], return_tensors="pt").pixel_values
|
39 |
+
pixel_values = pixel_values.to(device)
|
40 |
output_ids = model.generate(pixel_values, **gen_kwargs)
|
41 |
preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
42 |
preds = [pred.strip() for pred in preds]
|