Spaces:
Runtime error
Runtime error
Download app.py from PrecisionContent/DU: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/spaces/PrecisionContent/DU/resolve/main/app.py
- Command line
-
hf download hf://spaces/PrecisionContent/DU/app.py
-
curl -L -o app.py https://huggingface.co/spaces/PrecisionContent/DU/resolve/main/app.py
950 Bytes
| 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() |