mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
Allow image url as ChatBot response (#3953)
* fix(chatbot): allow url as chatbot response * chore(changelog): update changelog * fix: update per review Co-authored-by: Abubakar Abid <abubakar@huggingface.co> --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
4c0410579b
commit
6b854eefd4
@ -15,6 +15,7 @@ No changes to highlight.
|
|||||||
- Fix issue where requesting for a non-existing file would trigger a 500 error by [@micky2be](https://github.com/micky2be) in `[PR 3895](https://github.com/gradio-app/gradio/pull/3895)`.
|
- Fix issue where requesting for a non-existing file would trigger a 500 error by [@micky2be](https://github.com/micky2be) in `[PR 3895](https://github.com/gradio-app/gradio/pull/3895)`.
|
||||||
- Fix bugs with abspath about symlinks, and unresolvable path on Windows by [@micky2be](https://github.com/micky2be) in `[PR 3895](https://github.com/gradio-app/gradio/pull/3895)`.
|
- Fix bugs with abspath about symlinks, and unresolvable path on Windows by [@micky2be](https://github.com/micky2be) in `[PR 3895](https://github.com/gradio-app/gradio/pull/3895)`.
|
||||||
- Fixes type in client `Status` enum by [@10zinten](https://github.com/10zinten) in [PR 3931](https://github.com/gradio-app/gradio/pull/3931)
|
- Fixes type in client `Status` enum by [@10zinten](https://github.com/10zinten) in [PR 3931](https://github.com/gradio-app/gradio/pull/3931)
|
||||||
|
- Fix `gr.ChatBot` to handle image url [tye-singwa](https://github.com/tye-signwa) in [PR 3953](https://github.com/gradio-app/gradio/pull/3953)
|
||||||
|
|
||||||
## Documentation Changes:
|
## Documentation Changes:
|
||||||
|
|
||||||
|
@ -4581,9 +4581,13 @@ class Chatbot(Changeable, Selectable, IOComponent, JSONSerializable):
|
|||||||
if chat_message is None:
|
if chat_message is None:
|
||||||
return None
|
return None
|
||||||
elif isinstance(chat_message, (tuple, list)):
|
elif isinstance(chat_message, (tuple, list)):
|
||||||
filepath = chat_message[0]
|
file_uri = chat_message[0]
|
||||||
|
if utils.validate_url(file_uri):
|
||||||
|
filepath = file_uri
|
||||||
|
else:
|
||||||
|
filepath = self.make_temp_copy_if_needed(file_uri)
|
||||||
|
|
||||||
mime_type = client_utils.get_mimetype(filepath)
|
mime_type = client_utils.get_mimetype(filepath)
|
||||||
filepath = self.make_temp_copy_if_needed(filepath)
|
|
||||||
return {
|
return {
|
||||||
"name": filepath,
|
"name": filepath,
|
||||||
"mime_type": mime_type,
|
"mime_type": mime_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user