Spaces:
Running
Running
Commit
·
fb830f3
1
Parent(s):
4902aa0
Uploaded code files
Browse files
app.py
CHANGED
@@ -14,20 +14,6 @@ vlm = Qwen2VLForConditionalGeneration.from_pretrained(
|
|
14 |
device_map="auto",
|
15 |
)
|
16 |
|
17 |
-
rag.index(
|
18 |
-
input_path="./test1.png",
|
19 |
-
index_name="index",
|
20 |
-
store_collection_with_index=False,
|
21 |
-
overwrite=True,
|
22 |
-
)
|
23 |
-
|
24 |
-
text_query = "What is the text content displayed in the image?"
|
25 |
-
res = rag.search(text_query, k=1)
|
26 |
-
res
|
27 |
-
|
28 |
-
image = Image.open("./test2.jpg")
|
29 |
-
image_index = res[0]["page_num"] - 1
|
30 |
-
|
31 |
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True)
|
32 |
|
33 |
def extract_text(image, query):
|
|
|
14 |
device_map="auto",
|
15 |
)
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True)
|
18 |
|
19 |
def extract_text(image, query):
|