Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ import requests
|
|
9 |
import random
|
10 |
from gradio_client import Client, file
|
11 |
|
12 |
-
def generate_caption_instructblip(image_path):
|
13 |
client = Client("hysts/image-captioning-with-blip")
|
14 |
-
return client.predict(file(image_path), api_name="/caption")
|
15 |
|
16 |
def extract_text_from_webpage(html_content):
|
17 |
"""Extracts visible text from HTML content using BeautifulSoup."""
|
@@ -74,7 +74,7 @@ def respond(
|
|
74 |
for image in message["files"]:
|
75 |
vqa += "[CAPTION of IMAGE] "
|
76 |
gr.Info("Analyzing image")
|
77 |
-
vqa += generate_caption_instructblip(image)
|
78 |
print(vqa)
|
79 |
except:
|
80 |
vqa = ""
|
|
|
9 |
import random
|
10 |
from gradio_client import Client, file
|
11 |
|
12 |
+
def generate_caption_instructblip(image_path, question):
|
13 |
client = Client("hysts/image-captioning-with-blip")
|
14 |
+
return client.predict(file(image_path), f"{question}", api_name="/caption")
|
15 |
|
16 |
def extract_text_from_webpage(html_content):
|
17 |
"""Extracts visible text from HTML content using BeautifulSoup."""
|
|
|
74 |
for image in message["files"]:
|
75 |
vqa += "[CAPTION of IMAGE] "
|
76 |
gr.Info("Analyzing image")
|
77 |
+
vqa += generate_caption_instructblip(image, message["text"])
|
78 |
print(vqa)
|
79 |
except:
|
80 |
vqa = ""
|