Commit
·
7724338
1
Parent(s):
e6bc321
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
last_run = 0
|
3 |
+
import gradio as gr
|
4 |
+
def reboot():
|
5 |
+
global last_run
|
6 |
+
current_time = time.time()
|
7 |
+
if current_time - last_run >= 300:
|
8 |
+
last_run = current_time
|
9 |
+
|
10 |
+
else:
|
11 |
+
gr.Error("The Space has already been rebooted recently")
|
12 |
+
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("# Request a Reboot of [OpenDalle v1.1 GPU Demo](https://huggingface.co/spaces/mrfakename/OpenDalleV1.1-GPU-Demo)\n\nIs the demo not working? Request a reboot!")
|
14 |
+
btn = gr.Button("Reboot")
|
15 |
+
btn.click(reboot)
|
16 |
+
demo.launch()
|