File size: 883 Bytes
68c32d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)