causalens/dara

File browser ?

Closed this issue · 3 comments

gsal commented

In the docs, I seemed to have read about dropzone, or something, but it seems that it caters to data files, like excel, csv, that would yield a pandas dataframe.

Question: is there a generic "File Browser" widget that allows the user browse its local disk to upload any kind of file, *.txt, *.dat, *.png *.jpg, *.pdf ?

Hello,

The dropzone component can allow uploading any kind of file, see docs here. In particular, to enable that you should:

  • provide the desired list of accepted MIME-types to the accept argument
  • rather than providing a target which would be a DataVariable to store the tabular data, use the resolver argument; you can pass it a function which will be invoked with the raw uploaded bytes and the filename, which you can choose to e.g. dump to disk or do anything you wish with it

Let us know if that works for your use case.

gsal commented

Ah, ok. I have not fully implemented my own functionality, but it sure looks like is going to work; after doing what you indicated, providing a resolver, I do get bytes and filename.

I guess I need to do a better job reading the docs. The thing is that I have been exploring various frameworks and each seems to have its own docs style that needs some getting used to; for example, in Dara's case, I initially get the idea that the docs are incomplete when I see something like this:

image

But maybe that's just me.

Thanks again.

Thanks for the feedback. That page is autogenerated from the docstring on the component, I agree we could do a better job there.