Commit
·
ca3ca09
1
Parent(s):
1b4b059
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,10 @@ model, vis_processors, _ = load_model_and_preprocess(name="blip_caption", model_
|
|
10 |
|
11 |
# Define the input and output functions for Gradio
|
12 |
def generate_caption(image_file):
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
|
16 |
# Preprocess the image using the Blip-Caption model's visual processors
|
17 |
image = vis_processors["eval"](raw_image).unsqueeze(0)
|
|
|
10 |
|
11 |
# Define the input and output functions for Gradio
|
12 |
def generate_caption(image_file):
|
13 |
+
image = cv2.imdecode(image_file.read(), cv2.IMREAD_COLOR)
|
14 |
+
|
15 |
+
# Preprocess the image using the Blip-Caption model's visual processors
|
16 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
17 |
|
18 |
# Preprocess the image using the Blip-Caption model's visual processors
|
19 |
image = vis_processors["eval"](raw_image).unsqueeze(0)
|