Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
from PIL import Image
|
4 |
+
URL="https://source.unsplash.com/random/500x500/?nature,fruit"
|
5 |
+
|
6 |
+
def refresh():
|
7 |
+
image = Image.open(requests.get(URL, stream=True).raw)
|
8 |
+
return image
|
9 |
+
|
10 |
+
with gr.Blocks(show_footer=False) as blocks:
|
11 |
+
image = gr.Image(show_label=False)
|
12 |
+
blocks.load(fn=refresh, inputs=None, outputs=image, show_progress=False, queue=False, every=1, show_api=False)
|
13 |
+
|
14 |
+
blocks.queue(api_open=False)
|
15 |
+
blocks.launch()
|