Need help with file upload and autocomplete feature

I will be attaching images or pdfs, I’ve written a function get_text(file) where it returns a dictionary with values for the doctype fields. For example it returns a dictionary dict with dict[“name”] = joe, dict[“id”] = “5”, dict[“age”]=“25”

Now, I want to know how can I pass this file inside my function get_text(file). What exactly do I pass as “file”, or in other words, what is the upload path.

@frappe.whitelist()
def process_file(file_url):
    # Fetch the file from the File doctype
    file_doc = frappe.get_doc("File", {"file_url": file_url})
    
    # Read the file from the stored location
    file_path = file_doc.get_full_path()
    
    # Pass the file to your get_text function
    extracted_data = get_text(file_path)
    
    # Return the extracted data to the frontend
    return extracted_data

def get_text(file_path):
    # Your logic to extract text or data from the file
    extracted_data = {
        "name": "John Doe",
        "id": "12345",
        "age": "30"
    }
    return extracted_data

now

frappe.ui.form.on('infos', {
    upload_file: function(frm) {
        if (frm.doc.upload_file) {
            // Get the file URL
            const file_url = frm.doc.upload_file;
            
            // Call a custom method to process the file
            frappe.call({
                method: "your_app.your_module.doctype.infos.infos.process_file",
                args: {
                    file_url: file_url
                },
                callback: function(r) {
                    if (r.message) {
                        // Use the returned data to set fields in the form
                        frm.set_value('name', r.message.name);
                        frm.set_value('id', r.message.id);
                        frm.set_value('age', r.message.age);
                    }
                }
            });
        }
    }
});