Spaces:
Sleeping
Sleeping
Commit
·
530e836
1
Parent(s):
43d295d
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!"
|
5 |
|
6 |
with gr.Blocks(show_footer=False) as blocks:
|
7 |
image = gr.Image(show_label=False)
|
8 |
-
blocks.load(fn=
|
|
|
9 |
|
10 |
blocks.queue(api_open=False)
|
11 |
-
blocks.launch()
|
12 |
-
|
13 |
-
#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
14 |
-
#demo.launch()
|
|
|
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 |
+
|
7 |
+
def refresh():
|
8 |
+
image = Image.open(requests.get(URL, stream=True).raw)
|
9 |
+
return image
|
10 |
|
|
|
|
|
11 |
|
12 |
with gr.Blocks(show_footer=False) as blocks:
|
13 |
image = gr.Image(show_label=False)
|
14 |
+
blocks.load(fn=refresh, inputs=None, outputs=image,
|
15 |
+
show_progress=False, every=1)
|
16 |
|
17 |
blocks.queue(api_open=False)
|
18 |
+
blocks.launch()
|
|
|
|
|
|