gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.46k stars 2.53k forks source link

Gradio gr.HTML() does not support the video. #9851

Closed LinghaoChan closed 4 hours ago

LinghaoChan commented 4 hours ago

Describe the bug

This is my gradio code:

video_dis = f'<video controls playsinline width="{width}" style="display: block; margin: 0 auto;" src="./file={save_path}"></video>'

When I use the gr.HTML() to visit the video, it does not work. But the gr.Video() works. This issue comes come gradio 5. Gradio 4 for this is ok. Both relative and absolute path are not ok. I tried to use the curl to visit the video address, the result:

evan@EvandeMacBook-Pro Desktop % curl -I https://evanthu-motionclr.hf.space/file=/home/user/app/temp/ac876a3d7e1a5b960009f99099153925.mp4
HTTP/2 308
date: Thu, 24 Oct 2024 09:00:43 GMT
content-length: 0
server: uvicorn
location: /
x-proxied-host: http://10.61.83.119/
x-proxied-path: /file=/home/user/app/temp/ac876a3d7e1a5b960009f99099153925.mp4
link: <https://huggingface.co/spaces/EvanTHU/MotionCLR>;rel="canonical"
x-request-id: Xvo8f7
vary: origin, access-control-request-method, access-control-request-headers
access-control-allow-credentials: true

Have you searched existing issues? 🔎

Reproduction

video_dis = f'<video controls playsinline width="{width}" style="display: block; margin: 0 auto;" src="./file={save_path}"></video>'

Screenshot

No response

Logs

No response

System Info

gradio 5.x.x

Severity

I can work around it

freddyaboulton commented 4 hours ago

Hi @LinghaoChan , the file url is now /gradio_api/file=.... See #9844 and #9680. make sure the video file is in the allowed_paths parameter of launch.