Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
#!/usr/bin/env python3
|
2 |
import os
|
3 |
import glob
|
4 |
-
import time
|
5 |
import streamlit as st
|
6 |
from PIL import Image
|
7 |
import torch
|
@@ -172,9 +172,8 @@ with tab2:
|
|
172 |
if st.button("Run OCR 🚀", key="ocr_run"):
|
173 |
if ocr_model == "Qwen2-VL-OCR-2B":
|
174 |
processor, model = load_ocr_qwen2vl()
|
175 |
-
#
|
176 |
-
|
177 |
-
inputs = processor(messages, return_tensors="pt").to("cpu")
|
178 |
outputs = model.generate(**inputs, max_new_tokens=1024)
|
179 |
text = processor.batch_decode(outputs, skip_special_tokens=True)[0]
|
180 |
else: # GOT-OCR2_0
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
import os
|
3 |
import glob
|
4 |
+
import time
|
5 |
import streamlit as st
|
6 |
from PIL import Image
|
7 |
import torch
|
|
|
172 |
if st.button("Run OCR 🚀", key="ocr_run"):
|
173 |
if ocr_model == "Qwen2-VL-OCR-2B":
|
174 |
processor, model = load_ocr_qwen2vl()
|
175 |
+
# Simplified input: pass image and text directly
|
176 |
+
inputs = processor(text=prompt, images=image, return_tensors="pt").to("cpu")
|
|
|
177 |
outputs = model.generate(**inputs, max_new_tokens=1024)
|
178 |
text = processor.batch_decode(outputs, skip_special_tokens=True)[0]
|
179 |
else: # GOT-OCR2_0
|