File size: 950 Bytes
4cf70e0
 
3720c4d
097e81a
c1789c7
d465175
c1789c7
 
 
 
d1d70b6
 
4cf70e0
d1d70b6
 
46e2995
 
4cf70e0
 
 
 
d1d70b6
b72e4e6
 
 
 
 
2faa652
c075b07
b72e4e6
 
4cf70e0
 
d465175
4cf70e0
 
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
import gradio as gr

import parse
import understand
import llm
import logger

from dotenv import load_dotenv
load_dotenv()

LLM = llm.OpenAI()

def process(filename, model):
    LLM.set_model(model)
    doc = understand.Document(LLM)
    doc.ingest(filename)
    return doc.get_understanding()
   
gradio_app = gr.Interface(
    fn=process, 
    allow_flagging="auto",
    inputs=[gr.File(label="Input document (HTML)"), gr.Dropdown(choices=LLM.get_models(), value=LLM.get_models()[0])],
    outputs=[
        gr.Textbox(label="Document type", lines=1), 
        gr.Textbox(label="Summary", lines=8), 
        gr.Textbox(label="Concepts", lines=10), 
        gr.Textbox(label="Actors", lines=10),
        gr.Textbox(label="Document, annotated with actors", lines=18),
        gr.Textbox(label="Document broken into sections", lines=18),
        ]
        )

if __name__ == "__main__":
    logger.info("DU starts!")
    gradio_app.launch()
    #test()