import json import os import re import statistics import gradio as gr import pandas as pd from pdftoqa_generator import * def predict(file): resource = pdf_parser(file) qa_notes = qa_generator(resource) return qa_notes description = """Do you have a long document and a bunch of questions that can be answered given the data in this file? Fear not for this demo is for you. Upload your pdf, ask your questions and wait for the magic to happen. DISCLAIMER: I do no have idea what happens to the pdfs that you upload and who has access to them so make sure there is nothing confidential there. """ title = "QA answering from a pdf." iface = gr.Interface( fn=predict, inputs=[ gr.inputs.File(), ], outputs="text", description=description, title=title, allow_screenshot=True, ) iface.launch(enable_queue=True, show_error=True)