omerXfaruq commited on
Commit
b8ac61b
1 Parent(s): 6677ed7

Remove spaces hardcoding, and support models as well.

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. tests.py +8 -8
app.py CHANGED
@@ -28,7 +28,7 @@ class SpaceBuilder:
28
  filtered_list = []
29
  for name in name_list:
30
  if not (name == "" or name.isspace()):
31
- filtered_list.append(f"spaces/{name}")
32
  return filtered_list
33
 
34
  @classmethod
@@ -226,9 +226,9 @@ if __name__ == "__main__":
226
  gr.inputs.Textbox(
227
  lines=4,
228
  placeholder=(
229
- f"Drop space links at each line and I will create a new space comparing them. ie:"
230
- f"\ndeepklarity/poster2plot"
231
- f"\ndeepklarity/poster2plot"
232
  ),
233
  ),
234
  gr.inputs.Textbox(lines=1, placeholder="HuggingFace Write Token"),
28
  filtered_list = []
29
  for name in name_list:
30
  if not (name == "" or name.isspace()):
31
+ filtered_list.append(name)
32
  return filtered_list
33
 
34
  @classmethod
226
  gr.inputs.Textbox(
227
  lines=4,
228
  placeholder=(
229
+ f"Drop model and space links at each line and I will create a new space comparing them. Usage examples:"
230
+ f"\nspaces/deepklarity/poster2plot"
231
+ f"\nmodels/gpt2"
232
  ),
233
  ),
234
  gr.inputs.Textbox(lines=1, placeholder="HuggingFace Write Token"),
tests.py CHANGED
@@ -6,14 +6,14 @@ class TestUnit:
6
  class TestSpaceBuilder:
7
  def test_split_space_names(self):
8
  input = (
9
- f"nielsr/LayoutLMv2-FUNSD"
10
- f"\nvalhalla/glide-text2im"
11
  f"\n"
12
  f"\n "
13
  f"\n "
14
- f"\nvalhalla/glide-text2im"
15
  f"\n "
16
- f"\nvalhalla/glide-text2im"
17
  f"\n"
18
  )
19
  expected_output = (
@@ -28,14 +28,14 @@ class TestUnit:
28
 
29
  def test_load_and_check_spaces_1(self):
30
  input = (
31
- f"nielsr/LayoutLMv2-FUNSD"
32
- f"\nvalhalla/glide-text2im"
33
  )
34
  assert SpaceBuilder.load_and_check_spaces(names=input) is False
35
 
36
  def test_load_and_check_spaces_2(self):
37
  input = (
38
- f"valhalla/glide-text2im"
39
- f"\nvalhalla/glide-text2im"
40
  )
41
  assert SpaceBuilder.load_and_check_spaces(names=input) is True
6
  class TestSpaceBuilder:
7
  def test_split_space_names(self):
8
  input = (
9
+ f"spaces/nielsr/LayoutLMv2-FUNSD"
10
+ f"\nspaces/valhalla/glide-text2im"
11
  f"\n"
12
  f"\n "
13
  f"\n "
14
+ f"\nspaces/valhalla/glide-text2im"
15
  f"\n "
16
+ f"\nspaces/valhalla/glide-text2im"
17
  f"\n"
18
  )
19
  expected_output = (
28
 
29
  def test_load_and_check_spaces_1(self):
30
  input = (
31
+ f"spaces/nielsr/LayoutLMv2-FUNSD"
32
+ f"\nspaces/valhalla/glide-text2im"
33
  )
34
  assert SpaceBuilder.load_and_check_spaces(names=input) is False
35
 
36
  def test_load_and_check_spaces_2(self):
37
  input = (
38
+ f"spaces/valhalla/glide-text2im"
39
+ f"\nspaces/valhalla/glide-text2im"
40
  )
41
  assert SpaceBuilder.load_and_check_spaces(names=input) is True