gradio/demo/image_remote_url/run.py
Yuichiro Tachibana (Tsuchiya) 522daf787a
Patch async_save_url_to_cache for Lite (#8026)
* Update `async_save_url_to_cache` to work on Wasm

* Refactoring `save_url_to_cache`

* add changeset

* Fix

* Use pyodide.http as a custom transport of httpx

* Use urllib3 as a custom transport of httpx to make sync http requests

* Add an E2E test case to detect the bugs on remote resource caching

* add changeset

* Add image_remote_url E2E test

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-17 03:54:34 +09:00

20 lines
374 B
Python

import gradio as gr
def fn(im):
return im, "https://picsum.photos/400/300"
demo = gr.Interface(
fn=fn,
inputs=gr.Image("https://picsum.photos/300/200", label="InputImage"),
outputs=[gr.Image(label="Loopback"), gr.Image(label="RemoteImage")],
examples=[
["https://picsum.photos/640/480"]
]
)
if __name__ == "__main__":
demo.launch()