Ankur Goyal commited on
Commit ·
d1e1ea7
1
Parent(s): 194858a
Improve answer preview
Browse files125 unmodified lines12612712812913013113213313413515 unmodified lines151152153154155156157125 unmodified linesif document is None:return None, None, Nonepredictions = run_pipeline(model, question, document, 3)pages = [x.copy().convert("RGB") for x in document.preview]for i, p in enumerate(ensure_list(predictions)):if i > 0:# Keep the code around to produce multiple boxes, but only show the top# prediction for nowbreak15 unmodified linesgr.update(visible=True, value=predictions),gr.update(visible=True,value=predictions[0]["answer"] if ensure_list(predictions) else None,),)125 unmodified lines12612712812913013113213313413513613713815 unmodified lines154155156157158159160125 unmodified linesif document is None:return None, None, Nonetext_value = Nonepredictions = run_pipeline(model, question, document, 3)pages = [x.copy().convert("RGB") for x in document.preview]for i, p in enumerate(ensure_list(predictions)):if i == 0:text_value = p["answer"]else:# Keep the code around to produce multiple boxes, but only show the top# prediction for nowbreak15 unmodified linesgr.update(visible=True, value=predictions),gr.update(visible=True,value=text_value,),)
app.py+5-2