shtif commited on
Commit
ce487ea
·
1 Parent(s): 3428358

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -11,12 +11,13 @@ model = BlipForConditionalGeneration.from_pretrained(model_id)
11
  processor = BlipProcessor.from_pretrained(model_id)
12
 
13
  def launch(input):
14
- inputs = []
15
  for file in input:
16
- inputs.append(processor(Image.open(file.name), return_tensors="pt"))
17
-
18
- out = model.generate(*inputs)
19
- return processor.decode(out[0], skip_special_tokens=True)
 
20
 
21
  description = "Simple BLIP test app for image captioning."
22
 
 
11
  processor = BlipProcessor.from_pretrained(model_id)
12
 
13
  def launch(input):
14
+ outputs = []
15
  for file in input:
16
+ inputs = processor(Image.open(file.name), return_tensors="pt")
17
+ out = model.generate(**inputs)
18
+ outputs.append(processor.decode(out[0], skip_special_tokens=True)
19
+
20
+ return outputs
21
 
22
  description = "Simple BLIP test app for image captioning."
23