Bobby commited on
Commit
5fdc8bd
·
1 Parent(s): 66cfa26

Remove hourly HF Space self-restarts

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py CHANGED
@@ -3,7 +3,6 @@ import hashlib
3
  import html
4
  import os
5
  import re
6
- import threading
7
  import time
8
 
9
  os.environ.setdefault("PYTORCH_ENABLE_MPS_FALLBACK", "1")
@@ -16,7 +15,6 @@ import gradio as gr
16
  import gradio.route_utils
17
  import spaces
18
  import torch
19
- from huggingface_hub import HfApi
20
  from PIL import Image
21
  from pillow_heif import register_heif_opener
22
  from starlette.middleware import Middleware
@@ -77,25 +75,6 @@ async def _force_light_theme(request, call_next):
77
 
78
  force_light_middleware = Middleware(BaseHTTPMiddleware, dispatch=_force_light_theme)
79
 
80
- RESTART_INTERVAL_SECONDS = 3600
81
-
82
-
83
- def _restart_space_after_interval(space_id):
84
- time.sleep(RESTART_INTERVAL_SECONDS)
85
- try:
86
- HfApi().restart_space(space_id)
87
- except Exception as exc:
88
- print(f"Auto-restart failed: {exc}", flush=True)
89
-
90
-
91
- space_id = os.getenv("SPACE_ID")
92
- if space_id:
93
- threading.Thread(
94
- target=_restart_space_after_interval,
95
- args=(space_id,),
96
- daemon=True,
97
- ).start()
98
-
99
  TILE = 768
100
  OVERLAP = 192
101
  UPSCALE = 1.0
 
3
  import html
4
  import os
5
  import re
 
6
  import time
7
 
8
  os.environ.setdefault("PYTORCH_ENABLE_MPS_FALLBACK", "1")
 
15
  import gradio.route_utils
16
  import spaces
17
  import torch
 
18
  from PIL import Image
19
  from pillow_heif import register_heif_opener
20
  from starlette.middleware import Middleware
 
75
 
76
  force_light_middleware = Middleware(BaseHTTPMiddleware, dispatch=_force_light_theme)
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  TILE = 768
79
  OVERLAP = 192
80
  UPSCALE = 1.0