Skip to content
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

Chat interface cannot correctly show markdown image from local disk after upgrading to 5.0 #9680

Closed
1 task done
FitzWang opened this issue Oct 12, 2024 · 4 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working Priority High priority issues

Comments

@FitzWang
Copy link

FitzWang commented Oct 12, 2024

Describe the bug

before the version of 5.0, I can correctly inject markdown string to the chat interface to show the image correctly.
The string lookslike: ![](file=images/xxx.png)
The .launch() cmd includes the image storage path and look like: demo.launch(allowed_paths=["/xx/xx/xx/"])
However, after upgrading to version 5.0.2, the image cannot been shown and only white space.
The markdown image display comparison between 4.44 and 5.0.2:
Screenshot 2024-10-12 at 12 59 02
Screenshot 2024-10-12 at 13 06 26
However, for very rare situation in version 5.0.2, it will correctly display certain image.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import time
import gradio as gr

def slow_echo(message, history):
    for i in range(len(message)):
        # time.sleep(0.05)
        yield "You typed: " + message[: i + 1]

demo = gr.ChatInterface(slow_echo, type="messages")

if __name__ == "__main__":
    demo.launch(allowed_paths=["/xxx/xx0", "/xxx/xx1"])

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 5.0.2
gradio_client version: 1.4.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.4.0
fastapi: 0.111.0
ffmpy: 0.3.2
gradio-client==1.4.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.25.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 1.26.4
orjson: 3.10.5
packaging: 24.1
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.4
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.10
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.12.2
urllib3: 2.2.2
uvicorn: 0.30.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.6.0
httpx: 0.27.0
huggingface-hub: 0.25.2
packaging: 24.1
typing-extensions: 4.12.2
websockets: 11.0.3

Severity

Blocking usage of gradio

@FitzWang FitzWang added the bug Something isn't working label Oct 12, 2024
@abidlabs abidlabs added the Priority High priority issues label Oct 12, 2024
@amirabdullah19852020
Copy link

Yes, I can confirm seeing similar behavior when upgrading to 5.0.2.

@freddyaboulton freddyaboulton self-assigned this Oct 17, 2024
@freddyaboulton
Copy link
Collaborator

Hi all! You need to use put a ! before the markdown (![](...)) and the url now begins with /gradio_api/.

@freddyaboulton
Copy link
Collaborator

Just verified that works for me so will close

@freddyaboulton freddyaboulton closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
@FitzWang
Copy link
Author

FitzWang commented Oct 17, 2024

Hi all! You need to use put a ! before the markdown (![](...)) and the url now begins with /gradio_api/.

Hi, I'm still not very clear.

  1. I'v already put a '!' before the markdown string. see the image in the issue description.
image
  1. "the url begins with '/gradio_api/'" means the markdown url should be ![](file=/gradio_api/my/path/to/the/image) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority High priority issues
Projects
None yet
Development

No branches or pull requests

4 participants