Spaces:
Runtime error
Runtime error
Commit
·
b20d2a3
1
Parent(s):
9ebd590
pages referenced before assignment
Browse files
app.py
CHANGED
@@ -241,9 +241,9 @@ MODELS = {
|
|
241 |
|
242 |
def process_question(question, document, model=list(MODELS.keys())[0]):
|
243 |
prediction = MODELS[model](question=question, document=document)
|
|
|
244 |
text_value = prediction["answer"]
|
245 |
if "word_ids" in prediction:
|
246 |
-
pages = [x.copy().convert("RGB") for x in document.preview]
|
247 |
image = pages[prediction["page"]]
|
248 |
draw = ImageDraw.Draw(image, "RGBA")
|
249 |
word_boxes = lift_word_boxes(document, prediction["page"])
|
|
|
241 |
|
242 |
def process_question(question, document, model=list(MODELS.keys())[0]):
|
243 |
prediction = MODELS[model](question=question, document=document)
|
244 |
+
pages = [x.copy().convert("RGB") for x in document.preview]
|
245 |
text_value = prediction["answer"]
|
246 |
if "word_ids" in prediction:
|
|
|
247 |
image = pages[prediction["page"]]
|
248 |
draw = ImageDraw.Draw(image, "RGBA")
|
249 |
word_boxes = lift_word_boxes(document, prediction["page"])
|