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()