admin commited on
Commit
d93eb2d
·
1 Parent(s): 609a724

support url reponame input

Browse files
Files changed (1) hide show
  1. modules/restart.py +10 -2
modules/restart.py CHANGED
@@ -31,13 +31,17 @@ def self_restart():
31
 
32
 
33
  # UI func
34
- def test_hf_restart(repo):
35
  status = "Success"
36
  logs = None
37
  try:
38
  if not repo:
39
  raise ValueError("Empty repo!")
40
 
 
 
 
 
41
  logs = restart_private_space(repo)
42
  logs += f"\nSuccessfully restart {HF_DOMAIN}/spaces/{repo}\n"
43
 
@@ -47,13 +51,17 @@ def test_hf_restart(repo):
47
  return status, logs
48
 
49
 
50
- def test_ms_restart(repo):
51
  status = "Success"
52
  logs = None
53
  try:
54
  if not repo:
55
  raise ValueError("Empty repo!")
56
 
 
 
 
 
57
  logs = restart_private_studio(repo)
58
  logs += f"\nSuccessfully restart {MS_DOMAIN}/studios/{repo}\n"
59
 
 
31
 
32
 
33
  # UI func
34
+ def test_hf_restart(repo: str):
35
  status = "Success"
36
  logs = None
37
  try:
38
  if not repo:
39
  raise ValueError("Empty repo!")
40
 
41
+ if f"{HF_DOMAIN}/spaces/" in repo:
42
+ repo = repo.split("/spaces/")[1].split("/")[:2]
43
+ repo = "/".join(repo)
44
+
45
  logs = restart_private_space(repo)
46
  logs += f"\nSuccessfully restart {HF_DOMAIN}/spaces/{repo}\n"
47
 
 
51
  return status, logs
52
 
53
 
54
+ def test_ms_restart(repo: str):
55
  status = "Success"
56
  logs = None
57
  try:
58
  if not repo:
59
  raise ValueError("Empty repo!")
60
 
61
+ if f"{MS_DOMAIN}/studios/" in repo:
62
+ repo = repo.split("/studios/")[1].split("/")[:2]
63
+ repo = "/".join(repo)
64
+
65
  logs = restart_private_studio(repo)
66
  logs += f"\nSuccessfully restart {MS_DOMAIN}/studios/{repo}\n"
67