-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Coming soon] st.chat_input
: Support for image and file input
#7409
Comments
It's a reasonable request when many modals will support image input 🤔 |
Yup we definitely want to support this! What do y'all think would be the best return format for an image? Maybe a PIL image or a numpy array? |
for the format, in the scenario of gpt4v, base64 maybe a better format. lol 🤣 |
Pil
发自我的iPhone
…------------------ Original ------------------
From: Johannes Rieke ***@***.***>
Date: Fri,Nov 10,2023 9:26 AM
To: streamlit/streamlit ***@***.***>
Cc: Betterme ***@***.***>, Author ***@***.***>
Subject: Re: [streamlit/streamlit] chat_input Support for image input (Issue#7409)
Yup we definitely want to support this! What do y'all think would be the best return format for an image? Maybe a PIL image or a numpy array?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I would say PIL is the most Pythonic format for the return value. Input should of course be anything from filename string to bytes array 😁 |
numpy |
st.chat_input
: Support for image and file input
st.chat_input
: Support for image and file inputst.chat_input
: Support for image and file input
UpdateHey all! We just started working on this. Here's a very early prototype (note that the design is very scrappy for now, we'll obviously improve that!): https://file-uploader-in-chat-input.streamlit.app/ APIThis works by adding two new parameters to chat input: st.chat_input(..., accept_file=False|True|"multiple", file_type=None|str|List[str]) So for example to accept a single image file, you would do: st.chat_input(accept_file=True, file_type=["png", "jpg"]) If {
"text": "the user input",
"files": [UploadedFile(...), UploadedFile(...)]
} The type of the files ( Try it out!You can download the wheel file from here. Feel free to play around and post feedback below! We're finishing up a few things and need to add tests before we launch. |
Can't wait for the wheel :) ! Wish I could use it today for my code challenge haha. |
Hi @jrieke, Thanks for the info. To answer: No this is not available in nightly releases yet. |
Any update on this? Also we should have a similar audio recorder button along with file attachment |
Hey all, I just added a link to the wheel file (and updated the demo link) to my post above (or go directly here for the wheel file 😉 ). Let me know if you try it out and if there's any feedback! |
That's wonderful! Since you asked for feedback, I'm not sure about the design for multiple file uploads: it seems unconventional. Before uploading my second file, I expected it to appear under the first one, on its own line as a list. When it didn't, I thought, "It did not upload, and I can only upload one file"... until I saw the arrows, which are not very visible in the dark theme. It also requires a lot of clicks if you need to remove the last attachment you added. It also seems strange to refer to them as "pages". I think more traditional designs could look like either a list of files with one line each, small cards with a preview (like Slack/Discord), or without a preview (which could be a single row with horizontal scrolling if needed). Otherwise, the rest of the design is great! I like the progress bar and the user interface with a single file. Thank you for your great work, I'll use it straight away! |
@ddorn that's a great point -- we are working on a new design for multiple file uploads for the release version. And it would be closer to the traditional designs you brought up here. |
Very excited for this feature! Also, allowing image paste from clipboard would be super useful. Ideally through Ctrl-V when the chat input has focus, but a button would work too (similar functionality is present in streamlit-paste-button and st-img-pastebutton) EDIT: |
Hi all, super excited to see the release of this feature, it looks great! @sfc-gh-pchiu just wondering what release you are targeting this to land in? |
Probably in January or February! |
Checklist
Summary
chat_input Support for image input
Why?
chat_input Support for image input
How?
chat_input Support for image input
Additional Context
chat_input Support for image input
The text was updated successfully, but these errors were encountered: