Spaces:
Paused
Paused
Commit
•
f1028c7
1
Parent(s):
8cad9d2
Refactor app.py to use gr.Blocks for displaying time
Browse files
app.py
CHANGED
@@ -9,17 +9,15 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
9 |
time_start = datetime.now()
|
10 |
|
11 |
|
12 |
-
def show_time():
|
13 |
-
return f"Time started: {time_start}"
|
14 |
-
|
15 |
-
|
16 |
def restart():
|
17 |
gr.Info("Restarting space...")
|
18 |
restart_space("davanstrien/restart", token=HF_TOKEN)
|
19 |
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
scheduler = BackgroundScheduler()
|
25 |
job = scheduler.add_job(restart, "interval", minutes=2)
|
|
|
9 |
time_start = datetime.now()
|
10 |
|
11 |
|
|
|
|
|
|
|
|
|
12 |
def restart():
|
13 |
gr.Info("Restarting space...")
|
14 |
restart_space("davanstrien/restart", token=HF_TOKEN)
|
15 |
|
16 |
|
17 |
+
with gr.Blocks() as demo:
|
18 |
+
gr.Markdown(f"Time started: {time_start}")
|
19 |
+
|
20 |
+
demo.launch()
|
21 |
|
22 |
scheduler = BackgroundScheduler()
|
23 |
job = scheduler.add_job(restart, "interval", minutes=2)
|