File size: 458 Bytes
cb069f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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(show_footer=False) as blocks:
    image = gr.Image(show_label=False)
    blocks.load(fn=refresh, inputs=None, outputs=image, show_progress=False, queue=False, every=1, show_api=False)

blocks.queue(api_open=False)
blocks.launch()