Spaces:
Running
Running
update
Browse files
main.py
CHANGED
|
@@ -52,7 +52,7 @@ class KeepAliveProcess(object):
|
|
| 52 |
async def process(self):
|
| 53 |
try:
|
| 54 |
logger.info(f"[{self.name}; {self.url}] access...")
|
| 55 |
-
client = Client(
|
| 56 |
text = client.predict(
|
| 57 |
cmd="cat README.md | grep ^title | cut -c 8-",
|
| 58 |
api_name="/shell"
|
|
@@ -109,10 +109,32 @@ def async_thread_wrapper(coro_task):
|
|
| 109 |
return
|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
def main():
|
| 113 |
args = get_args()
|
| 114 |
|
| 115 |
-
value = environment.get(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
keep_alive_tasks_file = Path(args.keep_alive_tasks_file)
|
| 118 |
keep_alive_tasks_file.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 52 |
async def process(self):
|
| 53 |
try:
|
| 54 |
logger.info(f"[{self.name}; {self.url}] access...")
|
| 55 |
+
client = Client(self.url)
|
| 56 |
text = client.predict(
|
| 57 |
cmd="cat README.md | grep ^title | cut -c 8-",
|
| 58 |
api_name="/shell"
|
|
|
|
| 109 |
return
|
| 110 |
|
| 111 |
|
| 112 |
+
DEFAULT_TASKS = [
|
| 113 |
+
{
|
| 114 |
+
"task_url": "https://qgyd2021-douyin-and-youtube.hf.space/",
|
| 115 |
+
"task_interval": 3600,
|
| 116 |
+
"task_name": "Douyin & Youtube"
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"task_url": "https://intelli-zen-keep-alive-a.hf.space/",
|
| 120 |
+
"task_interval": 3600,
|
| 121 |
+
"task_name": "Keep Alive A"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"task_url": "https://intelli-zen-keep-alive-b.hf.space/",
|
| 125 |
+
"task_interval": 3600,
|
| 126 |
+
"task_name": "Keep Alive B"
|
| 127 |
+
}
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
def main():
|
| 131 |
args = get_args()
|
| 132 |
|
| 133 |
+
value = environment.get(
|
| 134 |
+
key="keep_alive_tasks",
|
| 135 |
+
default=DEFAULT_TASKS,
|
| 136 |
+
dtype=json.loads
|
| 137 |
+
)
|
| 138 |
|
| 139 |
keep_alive_tasks_file = Path(args.keep_alive_tasks_file)
|
| 140 |
keep_alive_tasks_file.parent.mkdir(parents=True, exist_ok=True)
|