spuun commited on
Commit
31a7fc1
1 Parent(s): 3726f9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,10 +10,10 @@ model = BlipForConditionalGeneration.from_pretrained(model_id)
10
  processor = BlipProcessor.from_pretrained(model_id)
11
 
12
  def launch(input):
13
- image = Image.open(requests.get(input, stream=True).raw).convert('RGB')
14
  inputs = processor(image, return_tensors="pt")
15
  out = model.generate(**inputs)
16
  return processor.decode(out[0], skip_special_tokens=True)
17
 
18
- iface = gr.Interface(launch, inputs="text", outputs="text")
19
  iface.launch()
 
10
  processor = BlipProcessor.from_pretrained(model_id)
11
 
12
  def launch(input):
13
+ image = Image.open(input).convert('RGB')
14
  inputs = processor(image, return_tensors="pt")
15
  out = model.generate(**inputs)
16
  return processor.decode(out[0], skip_special_tokens=True)
17
 
18
+ iface = gr.Interface(launch, inputs="image", outputs="text")
19
  iface.launch()