File size: 473 Bytes
cda7b4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)