INNER CODE UNIT · Python

load_file

Azure/logicapps · ai-sample/TokenizeDocFunction/function_app.py:26

def load_file(req):
    # accepts user input as a json object, decodes and returns the document data.
    loader_mapping = {
        "PDF": PyPDFLoader,
        "DOCUMENT": Docx2txtLoader,
        "MARKUP": UnstructuredMarkdownLoader,
        "TXT": TextLoader,
        "PPTX": UnstructuredPowerPointLoader,
        "HTML": UnstructuredHTMLLoader,
    }

    content = req["base64Content"]
    file_bytes = base64.b64decode(content)
    file = BytesIO(file_bytes)

    fd, path = tempfile.mkstemp()

    try:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…