import gradio as gr | |
import requests | |
from PIL import Image | |
URL = "https://source.unsplash.com/random/500x500/?nature,fruit" | |
def refresh(): | |
image = Image.open(requests.get(URL, stream=True).raw) | |
return image | |
with gr.Blocks() as blocks: | |
image = gr.Image(show_label=False) | |
blocks.load(fn=refresh, inputs=None, outputs=image, | |
show_progress=False, every=1) | |
blocks.queue(api_open=False) | |
blocks.launch(server_name='0.0.0.0', server_port=10093) | |