llm-pdf-qa / app.py
Sawon2023's picture
Updated App.py
dedfe3d
raw
history blame
873 Bytes
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 inside it.
"""
title = "Note Maker."
pdf_doc=gr.File(label="Load a pdf", file_types=['.pdf'], type="file")
iface = gr.Interface(
fn=predict,
inputs=[pdf_doc],
outputs="text",
description=description,
title=title,
)
iface.launch(show_error=True)