# Use File Manager to input a filepath to a function

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-file-manager-to-input-a-filepath-to-a-function%2F36467%3E%5C
**Category:** 🔒 Gradio\
**Created:** [April 13, 2023, 1:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-file-manager-to-input-a-filepath-to-a-function%2F36467 "2023-04-13T13:52:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndrewMay](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@AndrewMay](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAndrewMay)%5C
**Post date:** [April 13, 2023, 1:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-file-manager-to-input-a-filepath-to-a-function%2F36467%2F1 "2023-04-13T13:52:30Z")

</div>

Hi, I would like to allow users to use the File Manager to select a generic file (e.g. a Word document), so that the filepath for that file is passed to a function as a string, instead of passing a tempfile object.

E.g. User selects a Word document, the filepath for that document is then passed to a function which loads and processes the text from the document before returning some output.

I’ve tried using gr.File(), but this only seems to pass the actual file as a tempfile. I think gr.Image(type=“filepath”) does what I want, but this only works for images, not other filetypes.

Any help would be really appreciated!

Example code:

```auto
demo = gr.Blocks()

with demo:
    gr.Markdown("Upload a document to extract questions and get suggested responses.")

    with gr.Row():
        file_input = gr.File()
        file_output = gr.Textbox(label="Questions")

    file_button = gr.Button("Extract Questions")
    question_box = gr.Textbox(label="Question")

    suggest_button = gr.Button("Suggest Answers")
    suggest_output = gr.Textbox(label="Suggested Answer")

    file_button.click(
        fn=lambda x : extract_questions(document=x), 
        inputs=file_input, 
        outputs=file_output
    )
    suggest_button.click(
        fn=suggest_answer, 
        inputs=question_box, 
        outputs=suggest_output)

demo.launch()

```
