LiquidoNoNewtoniano commited on
Commit
70403dc
1 Parent(s): b2c7600

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -15,15 +15,14 @@ gen_kwargs = {"max_length": max_length, "num_beams": num_beams}
15
  def image_to_text(image_paths):
16
  images=[image_paths]
17
 
18
- pixel_values = feature_extractor(images=images, return_tensors="pt").pixel_values
19
- pixel_values = pixel_values.to(device)
20
 
21
- output_ids = model.generate(pixel_values, **gen_kwargs)
22
-
23
- preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
24
- preds = [pred.strip() for pred in preds]
25
- return preds[0]
26
 
 
 
 
27
 
28
  title = ""
29
  description = ""
 
15
  def image_to_text(image_paths):
16
  images=[image_paths]
17
 
18
+ pixel_values = feature_extractor(images=images, return_tensors="pt").pixel_values
19
+ pixel_values = pixel_values.to(device)
20
 
21
+ output_ids = model.generate(pixel_values, **gen_kwargs)
 
 
 
 
22
 
23
+ preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
24
+ preds = [pred.strip() for pred in preds]
25
+ return preds[0]
26
 
27
  title = ""
28
  description = ""