Update app.py
Browse files
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(
|
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="
|
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()
|